{smcl}
{com}{sf}{ul off}{txt}{.-}
       log:  {res}LICs.smcl
  {txt}log type:  {res}smcl
 {txt}opened on:  {res} 9 Jan 2011, 16:35:57

{com}. do "C:\Users\Piotr\AppData\Local\Temp\STD06000000.tmp"
{txt}
{com}. * ESTIMATING AR(p) BY CLASS
. 
. *** LICs ***
. 
. use REGRESSION\LIC_all.dta, clear
{txt}
{com}. 
. *** All incidents
. 
. *MIPT
. sum mAll

{txt}    Variable {c |}       Obs        Mean    Std. Dev.       Min        Max
{hline 13}{c +}{hline 56}
        mAll {c |}{res}       160       7.675    6.520939          0         27
{txt}
{com}. forvalues i=1/8 {c -(}
{txt}  2{com}. qui arima mAll, ar(1/`i')
{txt}  3{com}. estat ic
{txt}  4{com}. {c )-}

{txt}{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  160{col 25}        .{col 37}-470.2645{col 48}    3{col 57}  946.529{col 69} 955.7545
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  160{col 25}        .{col 37}-462.3015{col 48}    4{col 57} 932.6031{col 69} 944.9038
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  160{col 25}        .{col 37}-462.2156{col 48}    5{col 57} 934.4311{col 69}  949.807
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  160{col 25}        .{col 37}-460.5142{col 48}    6{col 57} 933.0284{col 69} 951.4795
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  160{col 25}        .{col 37}-459.9337{col 48}    7{col 57} 933.8674{col 69} 955.3936
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  160{col 25}        .{col 37}-459.8812{col 48}    8{col 57} 935.7624{col 69} 960.3638
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  160{col 25}        .{col 37}-459.2907{col 48}    9{col 57} 936.5814{col 69} 964.2579
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  160{col 25}        .{col 37} -458.939{col 48}   10{col 57} 937.8779{col 69} 968.6297
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{com}. 
. * estimating AR(2)
. 
. regress mAll L(1/2).mAll FUND POST SEPT Dp IRAQ, robust

{txt}Linear regression                                      Number of obs ={res}     158
                                                       {help j_robustsingular:F(  6,   150) =}       .
                                                       {txt}Prob > F      = {res}      .
                                                       {txt}R-squared     = {res} 0.5861
                                                       {txt}Root MSE      = {res} 4.2811

{txt}{hline 13}{c TT}{hline 64}
             {c |}               Robust
        mAll {c |}      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
{hline 13}{char +}{hline 64}
        mAll {c |}
         L1. {c |}  {res} .3947641    .085369     4.62   0.000     .2260831    .5634452
         {txt}L2. {c |}  {res} .2234063    .082346     2.71   0.007     .0606983    .3861143
        {txt}FUND {c |}  {res}  1.56071   .7346134     2.12   0.035     .1091833    3.012236
        {txt}POST {c |}  {res} 2.254848   1.139053     1.98   0.050     .0041869    4.505509
        {txt}SEPT {c |}  {res} 1.181612   2.026351     0.58   0.561    -2.822267     5.18549
          {txt}Dp {c |}  {res} 1.958106   2.008347     0.97   0.331    -2.010198    5.926409
        {txt}IRAQ {c |}  {res}-2.166796   2.359522    -0.92   0.360    -6.828988    2.495397
       {txt}_cons {c |}  {res} .9929868   .3358169     2.96   0.004     .3294444    1.656529
{txt}{hline 13}{c BT}{hline 64}

{com}. 
. predict double mAll_pred
{txt}(option xb assumed; fitted values)
(2 missing values generated)

{com}. line mAll mAll_pred Quarter
{res}{txt}
{com}. drop mAll_pred
{txt}
{com}. 
. *Testing null that 9/11 did have no impact on terrorism patterns (for F column)
. test SEPT Dp

{txt} ( 1)  {res}SEPT = 0
{txt} ( 2)  {res}Dp = 0

{txt}       F(  2,   150) ={res}    5.14
{txt}{col 13}Prob > F ={res}    0.0069
{txt}
{com}. 
. * Ljung-Box statistic Q(4) - testing H0: white noise(in residuals)--> the first 4 autocorrelations are jointly insignificant
. predict double resid, residual
{txt}(2 missing values generated)

{com}. wntestq resid, lags(4)

{txt}Portmanteau test for white noise
{hline 39}
 Portmanteau (Q) statistic = {res}    1.1998
{txt} Prob > chi2({res}4{txt})            = {res}    0.8781
{txt}
{com}. drop resid
{txt}
{com}. 
. *Negative binomial
. count if mAll==0
{res}   14
{txt}
{com}. * 14 zero observations - grid search to find c ==> c=0.01
. gen ystar=mAll
{txt}
{com}. replace ystar=0.01 if mAll==0
{txt}(14 real changes made)

{com}. gen lmAll=ln(ystar)
{txt}
{com}. nbreg mAll L(1/2).lmAll FUND POST SEPT Dp IRAQ, robust

{txt}Fitting Poisson model:

Iteration 0:{col 16}log pseudolikelihood = {res}-435.33307{txt}  
Iteration 1:{col 16}log pseudolikelihood = {res}-432.15742{txt}  
Iteration 2:{col 16}log pseudolikelihood = {res}-432.15471{txt}  
Iteration 3:{col 16}log pseudolikelihood = {res}-432.15471{txt}  

Fitting constant-only model:

Iteration 0:{col 16}log pseudolikelihood = {res}-491.74105{txt}  
Iteration 1:{col 16}log pseudolikelihood = {res}-487.97648{txt}  
Iteration 2:{col 16}log pseudolikelihood = {res} -487.9749{txt}  
Iteration 3:{col 16}log pseudolikelihood = {res} -487.9749{txt}  

Fitting full model:

Iteration 0:{col 16}log pseudolikelihood = {res}-445.44822{txt}  
Iteration 1:{col 16}log pseudolikelihood = {res}-430.98701{txt}  
Iteration 2:{col 16}log pseudolikelihood = {res}-409.85846{txt}  
Iteration 3:{col 16}log pseudolikelihood = {res}-409.64994{txt}  
Iteration 4:{col 16}log pseudolikelihood = {res}-406.45942{txt}  
Iteration 5:{col 16}log pseudolikelihood = {res}-406.44999{txt}  
Iteration 6:{col 16}log pseudolikelihood = {res}-406.44999{txt}  

Negative binomial regression                      Number of obs   =  {res}      158
{txt}Dispersion           = {res}mean                       {txt}Wald chi2({res}6{txt})    =  {res}        .
{txt}Log pseudolikelihood = {res}-406.44999                 {txt}Prob > chi2     =  {res}        .

{col 1}{text}{hline 13}{c TT}{hline 11}{hline 11}{hline 9}{hline 9}{hline 12}{hline 12}
{col 14}{text}{c |}{col 26}    Robust
{col 1}{text}        mAll{col 14}{c |}      Coef.{col 26}   Std. Err.{col 37}      z{col 46}   P>|z|{col 55}    [95% Conf. Interval]
{col 1}{text}{hline 13}{c +}{hline 11}{hline 11}{hline 9}{hline 9}{hline 12}{hline 12}
{col 1}{text}       lmAll{col 14}{c |}
{col 1}{text}         L1.{col 14}{c |}{result}{space 2} .2353253{col 26}{space 2} .0609987{col 37}{space 1}    3.86{col 46}{space 3}0.000{col 55}{space 3} .1157701{col 67}{space 3} .3548805
{col 1}{text}         L2.{col 14}{c |}{result}{space 2} .1769995{col 26}{space 2} .0550566{col 37}{space 1}    3.21{col 46}{space 3}0.001{col 55}{space 3} .0690907{col 67}{space 3} .2849084
{col 1}{text}        FUND{col 14}{c |}{result}{space 2} .4840535{col 26}{space 2} .1560598{col 37}{space 1}    3.10{col 46}{space 3}0.002{col 55}{space 3} .1781819{col 67}{space 3} .7899251
{col 1}{text}        POST{col 14}{c |}{result}{space 2} .2688369{col 26}{space 2} .1217855{col 37}{space 1}    2.21{col 46}{space 3}0.027{col 55}{space 3} .0301417{col 67}{space 3} .5075321
{col 1}{text}        SEPT{col 14}{c |}{result}{space 2} .1013559{col 26}{space 2} .1359944{col 37}{space 1}    0.75{col 46}{space 3}0.456{col 55}{space 3}-.1651882{col 67}{space 3}    .3679
{col 1}{text}          Dp{col 14}{c |}{result}{space 2} .1378169{col 26}{space 2} .1311362{col 37}{space 1}    1.05{col 46}{space 3}0.293{col 55}{space 3}-.1192053{col 67}{space 3} .3948392
{col 1}{text}        IRAQ{col 14}{c |}{result}{space 2}-.1694013{col 26}{space 2} .1674039{col 37}{space 1}   -1.01{col 46}{space 3}0.312{col 55}{space 3}-.4975068{col 67}{space 3} .1587043
{col 1}{text}       _cons{col 14}{c |}{result}{space 2} .7581247{col 26}{space 2} .1269797{col 37}{space 1}    5.97{col 46}{space 3}0.000{col 55}{space 3} .5092491{col 67}{space 3}    1.007
{col 1}{text}{hline 13}{c +}{hline 11}{hline 11}{hline 9}{hline 9}{hline 12}{hline 12}
{col 1}{text}    /lnalpha{col 14}{c |}{result}{space 2}-1.982711{col 27}{space 1} .2669077{col 55}{space 3} -2.50584{col 67}{space 3}-1.459582
{col 1}{text}{hline 13}{c +}{hline 12}{hline 12}{hline 8}{hline 8}{hline 12}{hline 12}
{col 1}{text}       alpha{col 14}{c |}{result}{space 2} .1376954{col 27}{space 1}  .036752{col 55}{space 3}  .081607{col 67}{space 3} .2323335
{col 1}{text}{hline 13}{c BT}{hline 11}{hline 11}{hline 9}{hline 9}{hline 12}{hline 12}

{com}. test

{txt} ( 1)  {res}[mAll]L.lmAll = 0
{txt} ( 2)  {res}[mAll]L2.lmAll = 0
{txt} ( 3)  {res}[mAll]FUND = 0
{txt} ( 4)  {res}[mAll]POST = 0
{txt} ( 5)  {res}[mAll]SEPT = 0
{txt} ( 6)  {res}[mAll]Dp = 0
{txt} ( 7)  {res}[mAll]IRAQ = 0

           {txt}chi2(  7) ={res}  214.50
         {txt}Prob > chi2 ={res}    0.0000

{txt}
{com}. predict double mAll_pred
{txt}(option n assumed; predicted number of events)
(2 missing values generated)

{com}. line mAll mAll_pred Quarter
{res}{txt}
{com}. 
. *Testing null that 9/11 did have no impact on terrorism patterns (for F column)
. test SEPT Dp

{txt} ( 1)  {res}[mAll]SEPT = 0
{txt} ( 2)  {res}[mAll]Dp = 0

{txt}{col 12}chi2(  2) ={res}    7.91
{txt}{col 10}Prob > chi2 =  {res}  0.0191
{txt}
{com}. * Ljung-Box statistic Q(4) - testing H0: white noise(in residuals)--> the first 4 autocorrelations are jointly insignificant
. *** Predicting Pearson residuals
. scalar s2 = exp(_b[/lnalpha]) 
{txt}
{com}. gen nbresidual = (mAll-mAll_pred)/sqrt( mAll_pred*(1+mAll_pred*s2) )
{txt}(2 missing values generated)

{com}. wntestq nbresidual, lags(4)

{txt}Portmanteau test for white noise
{hline 39}
 Portmanteau (Q) statistic = {res}    0.5250
{txt} Prob > chi2({res}4{txt})            = {res}    0.9710
{txt}
{com}. drop nbresidual mAll_pred
{txt}
{com}. 
. * Which one is better fit? Based on AIC and BIC
. qui nbreg mAll L(1/2).lmAll FUND POST SEPT Dp IRAQ, robust
{txt}
{com}. estat ic

{txt}{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  158{col 25}-487.9749{col 37}  -406.45{col 48}    8{col 57}    828.9{col 69} 853.4007
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{com}. qui regress mAll L(1/2).mAll FUND POST SEPT Dp IRAQ, robust
{txt}
{com}. estat ic

{txt}{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  158{col 25}-519.5372{col 37}-449.8522{col 48}    7{col 57} 913.7045{col 69} 935.1427
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{com}. qui nbreg mAll L(1/2).mAll FUND POST SEPT Dp IRAQ, robust
{txt}
{com}. estat ic

{txt}{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  158{col 25}-487.9749{col 37}-420.2461{col 48}    8{col 57} 856.4921{col 69} 880.9929
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{com}. qui poisson mAll L(1/2).mAll FUND POST SEPT Dp IRAQ, robust
{txt}
{com}. estat ic

{txt}{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  158{col 25} -704.808{col 37}-455.1608{col 48}    7{col 57} 924.3216{col 69} 945.7598
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{com}. drop ystar lmAll
{txt}
{com}. 
. *ITERATE
. sum iAll

{txt}    Variable {c |}       Obs        Mean    Std. Dev.       Min        Max
{hline 13}{c +}{hline 56}
        iAll {c |}{res}       160       11.55    13.03927          0         87
{txt}
{com}. forvalues i=1/8 {c -(}
{txt}  2{com}. qui arima iAll, ar(1/`i')
{txt}  3{com}. estat ic
{txt}  4{com}. {c )-}

{txt}{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  160{col 25}        .{col 37}-626.3454{col 48}    3{col 57} 1258.691{col 69} 1267.916
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  160{col 25}        .{col 37}-615.6423{col 48}    4{col 57} 1239.285{col 69} 1251.585
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  160{col 25}        .{col 37}-615.0705{col 48}    5{col 57} 1240.141{col 69} 1255.517
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  160{col 25}        .{col 37}-614.1703{col 48}    6{col 57} 1240.341{col 69} 1258.792
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  160{col 25}        .{col 37}-613.2947{col 48}    7{col 57} 1240.589{col 69} 1262.116
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  160{col 25}        .{col 37}-613.2946{col 48}    8{col 57} 1242.589{col 69} 1267.191
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  160{col 25}        .{col 37}-612.6773{col 48}    9{col 57} 1243.355{col 69} 1271.031
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  160{col 25}        .{col 37}-612.6761{col 48}   10{col 57} 1245.352{col 69} 1276.104
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{com}. 
. * Choosing model AR(2) according to AIC and AR(2) according to BIC
. * Estimating AR(2)
. 
. regress iAll L(1/2).iAll FUND POST SEPT Dp IRAQ, robust

{txt}Linear regression                                      Number of obs ={res}     158
                                                       {help j_robustsingular:F(  6,   150) =}       .
                                                       {txt}Prob > F      = {res}      .
                                                       {txt}R-squared     = {res} 0.3092
                                                       {txt}Root MSE      = {res} 11.102

{txt}{hline 13}{c TT}{hline 64}
             {c |}               Robust
        iAll {c |}      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
{hline 13}{char +}{hline 64}
        iAll {c |}
         L1. {c |}  {res} .1072032   .0771704     1.39   0.167    -.0452782    .2596846
         {txt}L2. {c |}  {res} .2303556   .1225703     1.88   0.062    -.0118318     .472543
        {txt}FUND {c |}  {res} 2.981412   2.301868     1.30   0.197    -1.566861    7.529686
        {txt}POST {c |}  {res} 8.368466   2.872428     2.91   0.004      2.69282    14.04411
        {txt}SEPT {c |}  {res}-5.766723   3.786487    -1.52   0.130    -13.24846    1.715016
          {txt}Dp {c |}  {res}-9.528891    2.54824    -3.74   0.000    -14.56397    -4.49381
        {txt}IRAQ {c |}  {res}-4.020346   2.776726    -1.45   0.150    -9.506893    1.466201
       {txt}_cons {c |}  {res} 3.718654   2.158107     1.72   0.087    -.5455621    7.982869
{txt}{hline 13}{c BT}{hline 64}

{com}. 
. predict double iAll_pred
{txt}(option xb assumed; fitted values)
(2 missing values generated)

{com}. line iAll iAll_pred Quarter
{res}{txt}
{com}. drop iAll_pred
{txt}
{com}. 
. *Testing null that 9/11 did have no impact on terrorism patterns (for F column)
. test SEPT Dp

{txt} ( 1)  {res}SEPT = 0
{txt} ( 2)  {res}Dp = 0

{txt}       F(  2,   150) ={res}   16.86
{txt}{col 13}Prob > F ={res}    0.0000
{txt}
{com}. 
. * Ljung-Box statistic Q(4) - testing H0: white noise(in residuals)--> the first 4 autocorrelations are jointly insignificant
. predict double resid, residual
{txt}(2 missing values generated)

{com}. wntestq resid, lags(4)

{txt}Portmanteau test for white noise
{hline 39}
 Portmanteau (Q) statistic = {res}    0.3948
{txt} Prob > chi2({res}4{txt})            = {res}    0.9829
{txt}
{com}. drop resid
{txt}
{com}. 
. *Negative binomial
. count if iAll==0
{res}    6
{txt}
{com}. * 6 zero observations - grid search to find c ==> c=0.99
. gen ystar=iAll
{txt}
{com}. replace ystar=0.99 if iAll==0
{txt}(6 real changes made)

{com}. gen liAll=ln(ystar)
{txt}
{com}. nbreg iAll L(1/2).liAll FUND POST SEPT Dp IRAQ, robust

{txt}Fitting Poisson model:

Iteration 0:{col 16}log pseudolikelihood = {res}-826.57332{txt}  
Iteration 1:{col 16}log pseudolikelihood = {res}-826.25888{txt}  
Iteration 2:{col 16}log pseudolikelihood = {res}-826.25294{txt}  
Iteration 3:{col 16}log pseudolikelihood = {res}-826.25293{txt}  

Fitting constant-only model:

Iteration 0:{col 16}log pseudolikelihood = {res}-553.13341{txt}  
Iteration 1:{col 16}log pseudolikelihood = {res}-551.09889{txt}  
Iteration 2:{col 16}log pseudolikelihood = {res}-551.09484{txt}  
Iteration 3:{col 16}log pseudolikelihood = {res}-551.09484{txt}  

Fitting full model:

Iteration 0:{col 16}log pseudolikelihood = {res}-526.02624{txt}  
Iteration 1:{col 16}log pseudolikelihood = {res}-520.28756{txt}  
Iteration 2:{col 16}log pseudolikelihood = {res}-517.15918{txt}  
Iteration 3:{col 16}log pseudolikelihood = {res} -517.1426{txt}  
Iteration 4:{col 16}log pseudolikelihood = {res} -517.1426{txt}  

Negative binomial regression                      Number of obs   =  {res}      158
{txt}Dispersion           = {res}mean                       {txt}Wald chi2({res}6{txt})    =  {res}        .
{txt}Log pseudolikelihood = {res}-517.1426                  {txt}Prob > chi2     =  {res}        .

{col 1}{text}{hline 13}{c TT}{hline 11}{hline 11}{hline 9}{hline 9}{hline 12}{hline 12}
{col 14}{text}{c |}{col 26}    Robust
{col 1}{text}        iAll{col 14}{c |}      Coef.{col 26}   Std. Err.{col 37}      z{col 46}   P>|z|{col 55}    [95% Conf. Interval]
{col 1}{text}{hline 13}{c +}{hline 11}{hline 11}{hline 9}{hline 9}{hline 12}{hline 12}
{col 1}{text}       liAll{col 14}{c |}
{col 1}{text}         L1.{col 14}{c |}{result}{space 2}-.0159209{col 26}{space 2}    .1535{col 37}{space 1}   -0.10{col 46}{space 3}0.917{col 55}{space 3}-.3167753{col 67}{space 3} .2849335
{col 1}{text}         L2.{col 14}{c |}{result}{space 2}  .172722{col 26}{space 2} .0762947{col 37}{space 1}    2.26{col 46}{space 3}0.024{col 55}{space 3} .0231872{col 67}{space 3} .3222569
{col 1}{text}        FUND{col 14}{c |}{result}{space 2}  .420387{col 26}{space 2} .2242655{col 37}{space 1}    1.87{col 46}{space 3}0.061{col 55}{space 3}-.0191654{col 67}{space 3} .8599393
{col 1}{text}        POST{col 14}{c |}{result}{space 2}  .673587{col 26}{space 2} .2090408{col 37}{space 1}    3.22{col 46}{space 3}0.001{col 55}{space 3} .2638745{col 67}{space 3}   1.0833
{col 1}{text}        SEPT{col 14}{c |}{result}{space 2}-.4783918{col 26}{space 2} .2923926{col 37}{space 1}   -1.64{col 46}{space 3}0.102{col 55}{space 3}-1.051471{col 67}{space 3} .0946871
{col 1}{text}          Dp{col 14}{c |}{result}{space 2}-2.333163{col 26}{space 2} .2080686{col 37}{space 1}  -11.21{col 46}{space 3}0.000{col 55}{space 3} -2.74097{col 67}{space 3}-1.925356
{col 1}{text}        IRAQ{col 14}{c |}{result}{space 2}-.3478542{col 26}{space 2} .2340453{col 37}{space 1}   -1.49{col 46}{space 3}0.137{col 55}{space 3}-.8065745{col 67}{space 3} .1108661
{col 1}{text}       _cons{col 14}{c |}{result}{space 2}  1.55345{col 26}{space 2} .4971527{col 37}{space 1}    3.12{col 46}{space 3}0.002{col 55}{space 3} .5790484{col 67}{space 3} 2.527851
{col 1}{text}{hline 13}{c +}{hline 11}{hline 11}{hline 9}{hline 9}{hline 12}{hline 12}
{col 1}{text}    /lnalpha{col 14}{c |}{result}{space 2}-.7096113{col 27}{space 1} .3332349{col 55}{space 3} -1.36274{col 67}{space 3}-.0564829
{col 1}{text}{hline 13}{c +}{hline 12}{hline 12}{hline 8}{hline 8}{hline 12}{hline 12}
{col 1}{text}       alpha{col 14}{c |}{result}{space 2} .4918353{col 27}{space 1} .1638967{col 55}{space 3} .2559586{col 67}{space 3} .9450826
{col 1}{text}{hline 13}{c BT}{hline 11}{hline 11}{hline 9}{hline 9}{hline 12}{hline 12}

{com}. test

{txt} ( 1)  {res}[iAll]L.liAll = 0
{txt} ( 2)  {res}[iAll]L2.liAll = 0
{txt} ( 3)  {res}[iAll]FUND = 0
{txt} ( 4)  {res}[iAll]POST = 0
{txt} ( 5)  {res}[iAll]SEPT = 0
{txt} ( 6)  {res}[iAll]Dp = 0
{txt} ( 7)  {res}[iAll]IRAQ = 0

           {txt}chi2(  7) ={res} 1984.32
         {txt}Prob > chi2 ={res}    0.0000

{txt}
{com}. predict double iAll_pred
{txt}(option n assumed; predicted number of events)
(2 missing values generated)

{com}. line iAll iAll_pred Quarter
{res}{txt}
{com}. 
. *Testing null that 9/11 did have no impact on terrorism patterns (for F column)
. test SEPT Dp

{txt} ( 1)  {res}[iAll]SEPT = 0
{txt} ( 2)  {res}[iAll]Dp = 0

{txt}{col 12}chi2(  2) ={res}  158.86
{txt}{col 10}Prob > chi2 =  {res}  0.0000
{txt}
{com}. * Ljung-Box statistic Q(4) - testing H0: white noise(in residuals)--> the first 4 autocorrelations are jointly insignificant
. *** Predicting Pearson residuals
. scalar s2 = exp(_b[/lnalpha]) 
{txt}
{com}. gen nbresidual = (iAll-iAll_pred)/sqrt( iAll_pred*(1+iAll_pred*s2) )
{txt}(2 missing values generated)

{com}. wntestq nbresidual, lags(4)

{txt}Portmanteau test for white noise
{hline 39}
 Portmanteau (Q) statistic = {res}    1.0184
{txt} Prob > chi2({res}4{txt})            = {res}    0.9070
{txt}
{com}. drop nbresidual iAll_pred
{txt}
{com}. 
. * Which one is better fit? Based on AIC and BIC
. qui nbreg iAll L(1/2).liAll FUND POST SEPT Dp IRAQ, robust
{txt}
{com}. estat ic

{txt}{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  158{col 25}-551.0948{col 37}-517.1426{col 48}    8{col 57} 1050.285{col 69} 1074.786
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{com}. qui regress iAll L(1/2).iAll FUND POST SEPT Dp IRAQ, robust
{txt}
{com}. estat ic

{txt}{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  158{col 25}-629.6358{col 37}-600.4102{col 48}    7{col 57}  1214.82{col 69} 1236.259
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{com}. qui nbreg iAll L(1/2).iAll FUND POST SEPT Dp IRAQ, robust
{txt}
{com}. estat ic

{txt}{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  158{col 25}-551.0948{col 37}-516.3896{col 48}    8{col 57} 1048.779{col 69}  1073.28
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{com}. qui poisson iAll L(1/2).iAll FUND POST SEPT Dp IRAQ, robust
{txt}
{com}. estat ic

{txt}{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  158{col 25}-1131.617{col 37}-817.3971{col 48}    8{col 57} 1650.794{col 69} 1675.295
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{com}. drop ystar liAll
{txt}
{com}. 
. *** Casualty incidents
. 
. *MIPT
. sum mCasualty

{txt}    Variable {c |}       Obs        Mean    Std. Dev.       Min        Max
{hline 13}{c +}{hline 56}
   mCasualty {c |}{res}       160     3.80625     3.77262          0         16
{txt}
{com}. tab Quarter if mCasualty==0

    {txt}Quarter {c |}      Freq.     Percent        Cum.
{hline 12}{c +}{hline 35}
     1968:1 {c |}{res}          1        3.13        3.13
{txt}     1968:2 {c |}{res}          1        3.13        6.25
{txt}     1968:3 {c |}{res}          1        3.13        9.38
{txt}     1968:4 {c |}{res}          1        3.13       12.50
{txt}     1969:1 {c |}{res}          1        3.13       15.63
{txt}     1969:2 {c |}{res}          1        3.13       18.75
{txt}     1969:4 {c |}{res}          1        3.13       21.88
{txt}     1970:3 {c |}{res}          1        3.13       25.00
{txt}     1971:4 {c |}{res}          1        3.13       28.13
{txt}     1972:1 {c |}{res}          1        3.13       31.25
{txt}     1972:2 {c |}{res}          1        3.13       34.38
{txt}     1972:3 {c |}{res}          1        3.13       37.50
{txt}     1973:1 {c |}{res}          1        3.13       40.63
{txt}     1973:2 {c |}{res}          1        3.13       43.75
{txt}     1973:4 {c |}{res}          1        3.13       46.88
{txt}     1974:3 {c |}{res}          1        3.13       50.00
{txt}     1975:2 {c |}{res}          1        3.13       53.13
{txt}     1976:4 {c |}{res}          1        3.13       56.25
{txt}     1977:3 {c |}{res}          1        3.13       59.38
{txt}     1979:4 {c |}{res}          1        3.13       62.50
{txt}     1980:1 {c |}{res}          1        3.13       65.63
{txt}     1980:2 {c |}{res}          1        3.13       68.75
{txt}     1980:3 {c |}{res}          1        3.13       71.88
{txt}     1980:4 {c |}{res}          1        3.13       75.00
{txt}     1981:2 {c |}{res}          1        3.13       78.13
{txt}     1981:4 {c |}{res}          1        3.13       81.25
{txt}     1982:1 {c |}{res}          1        3.13       84.38
{txt}     1987:2 {c |}{res}          1        3.13       87.50
{txt}     1997:3 {c |}{res}          1        3.13       90.63
{txt}     2000:2 {c |}{res}          1        3.13       93.75
{txt}     2007:2 {c |}{res}          1        3.13       96.88
{txt}     2007:4 {c |}{res}          1        3.13      100.00
{txt}{hline 12}{c +}{hline 35}
      Total {c |}{res}         32      100.00
{txt}
{com}. forvalues i=1/8 {c -(}
{txt}  2{com}. qui arima mCasualty, ar(1/`i')
{txt}  3{com}. estat ic
{txt}  4{com}. {c )-}

{txt}{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  160{col 25}        .{col 37}-388.3956{col 48}    3{col 57} 782.7911{col 69} 792.0167
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  160{col 25}        .{col 37}-378.5324{col 48}    4{col 57} 765.0648{col 69} 777.3655
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  160{col 25}        .{col 37}-377.5763{col 48}    5{col 57} 765.1525{col 69} 780.5284
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  160{col 25}        .{col 37}-376.1417{col 48}    6{col 57} 764.2835{col 69} 782.7345
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  160{col 25}        .{col 37}-374.6273{col 48}    7{col 57} 763.2546{col 69} 784.7809
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  160{col 25}        .{col 37}-374.6262{col 48}    8{col 57} 765.2523{col 69} 789.8537
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  160{col 25}        .{col 37} -374.619{col 48}    9{col 57}  767.238{col 69} 794.9146
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  160{col 25}        .{col 37}-374.4014{col 48}   10{col 57} 768.8028{col 69} 799.5545
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{com}. 
. * Choosing model AR(5) according to AIC and AR(2) according to BIC
. * Estimating AR(2)
. 
. regress mCasualty L(1/2).mCasualty FUND POST SEPT Dp IRAQ, robust

{txt}Linear regression                                      Number of obs ={res}     158
                                                       {help j_robustsingular:F(  6,   150) =}       .
                                                       {txt}Prob > F      = {res}      .
                                                       {txt}R-squared     = {res} 0.5634
                                                       {txt}Root MSE      = {res} 2.5498

{txt}{hline 13}{c TT}{hline 64}
             {c |}               Robust
   mCasualty {c |}      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
{hline 13}{char +}{hline 64}
   mCasualty {c |}
         L1. {c |}  {res} .3655609   .0853545     4.28   0.000     .1969086    .5342132
         {txt}L2. {c |}  {res} .2713024   .0815097     3.33   0.001     .1102469    .4323579
        {txt}FUND {c |}  {res} .7835842   .3936728     1.99   0.048      .005724    1.561444
        {txt}POST {c |}  {res} .9741822   .6426959     1.52   0.132    -.2957241    2.244088
        {txt}SEPT {c |}  {res} 1.060187    1.33169     0.80   0.427    -1.571106    3.691481
          {txt}Dp {c |}  {res} 2.157385   1.273547     1.69   0.092    -.3590234    4.673794
        {txt}IRAQ {c |}  {res}-1.055397    1.55818    -0.68   0.499    -4.134214     2.02342
       {txt}_cons {c |}  {res} .3853733   .1377823     2.80   0.006     .1131285    .6576182
{txt}{hline 13}{c BT}{hline 64}

{com}. 
. predict double mCasualty_pred
{txt}(option xb assumed; fitted values)
(2 missing values generated)

{com}. line mCasualty mCasualty_pred Quarter
{res}{txt}
{com}. drop mCasualty_pred
{txt}
{com}. 
. *Testing null that 9/11 did have no impact on terrorism patterns (for F column)
. test SEPT Dp

{txt} ( 1)  {res}SEPT = 0
{txt} ( 2)  {res}Dp = 0

{txt}       F(  2,   150) ={res}   21.19
{txt}{col 13}Prob > F ={res}    0.0000
{txt}
{com}. 
. * Ljung-Box statistic Q(4) - testing H0: white noise(in residuals)--> the first 4 autocorrelations are jointly insignificant
. predict double resid, residual
{txt}(2 missing values generated)

{com}. wntestq resid, lags(4)

{txt}Portmanteau test for white noise
{hline 39}
 Portmanteau (Q) statistic = {res}    7.0795
{txt} Prob > chi2({res}4{txt})            = {res}    0.1317
{txt}
{com}. drop resid
{txt}
{com}. 
. *Negative binomial
. count if mCasualty==0
{res}   32
{txt}
{com}. *32 zero observations - grid search to find c ==> c=0.93
. gen ystar=mCasualty
{txt}
{com}. replace ystar=0.93 if mCasualty==0
{txt}(32 real changes made)

{com}. gen lmCasualty=ln(ystar)
{txt}
{com}. nbreg mCasualty L(1/2).lmCasualty FUND POST SEPT Dp IRAQ, robust

{txt}Fitting Poisson model:

Iteration 0:{col 16}log pseudolikelihood = {res}-328.00085{txt}  
Iteration 1:{col 16}log pseudolikelihood = {res}-327.86014{txt}  
Iteration 2:{col 16}log pseudolikelihood = {res}-327.85994{txt}  
Iteration 3:{col 16}log pseudolikelihood = {res}-327.85994{txt}  

Fitting constant-only model:

Iteration 0:{col 16}log pseudolikelihood = {res}-390.10004{txt}  
Iteration 1:{col 16}log pseudolikelihood = {res}-389.67309{txt}  
Iteration 2:{col 16}log pseudolikelihood = {res}-389.67299{txt}  
Iteration 3:{col 16}log pseudolikelihood = {res}-389.67299{txt}  

Fitting full model:

Iteration 0:{col 16}log pseudolikelihood = {res} -351.6554{txt}  
Iteration 1:{col 16}log pseudolikelihood = {res}-326.85641{txt}  
Iteration 2:{col 16}log pseudolikelihood = {res}-320.86863{txt}  
Iteration 3:{col 16}log pseudolikelihood = {res}-319.88005{txt}  
Iteration 4:{col 16}log pseudolikelihood = {res} -319.8583{txt}  
Iteration 5:{col 16}log pseudolikelihood = {res}-319.85825{txt}  
Iteration 6:{col 16}log pseudolikelihood = {res}-319.85825{txt}  

Negative binomial regression                      Number of obs   =  {res}      158
{txt}Dispersion           = {res}mean                       {txt}Wald chi2({res}6{txt})    =  {res}        .
{txt}Log pseudolikelihood = {res}-319.85825                 {txt}Prob > chi2     =  {res}        .

{col 1}{text}{hline 13}{c TT}{hline 11}{hline 11}{hline 9}{hline 9}{hline 12}{hline 12}
{col 14}{text}{c |}{col 26}    Robust
{col 1}{text}   mCasualty{col 14}{c |}      Coef.{col 26}   Std. Err.{col 37}      z{col 46}   P>|z|{col 55}    [95% Conf. Interval]
{col 1}{text}{hline 13}{c +}{hline 11}{hline 11}{hline 9}{hline 9}{hline 12}{hline 12}
{col 1}{text}  lmCasualty{col 14}{c |}
{col 1}{text}         L1.{col 14}{c |}{result}{space 2} .3713047{col 26}{space 2} .0896211{col 37}{space 1}    4.14{col 46}{space 3}0.000{col 55}{space 3} .1956506{col 67}{space 3} .5469589
{col 1}{text}         L2.{col 14}{c |}{result}{space 2} .3415625{col 26}{space 2} .0935382{col 37}{space 1}    3.65{col 46}{space 3}0.000{col 55}{space 3} .1582309{col 67}{space 3}  .524894
{col 1}{text}        FUND{col 14}{c |}{result}{space 2} .6049132{col 26}{space 2} .1995398{col 37}{space 1}    3.03{col 46}{space 3}0.002{col 55}{space 3} .2138225{col 67}{space 3}  .996004
{col 1}{text}        POST{col 14}{c |}{result}{space 2} .1696375{col 26}{space 2} .1467827{col 37}{space 1}    1.16{col 46}{space 3}0.248{col 55}{space 3}-.1180513{col 67}{space 3} .4573264
{col 1}{text}        SEPT{col 14}{c |}{result}{space 2} .1356777{col 26}{space 2} .1670409{col 37}{space 1}    0.81{col 46}{space 3}0.417{col 55}{space 3}-.1917164{col 67}{space 3} .4630718
{col 1}{text}          Dp{col 14}{c |}{result}{space 2} .5952473{col 26}{space 2} .1734498{col 37}{space 1}    3.43{col 46}{space 3}0.001{col 55}{space 3}  .255292{col 67}{space 3} .9352025
{col 1}{text}        IRAQ{col 14}{c |}{result}{space 2}-.1345436{col 26}{space 2} .2003969{col 37}{space 1}   -0.67{col 46}{space 3}0.502{col 55}{space 3}-.5273144{col 67}{space 3} .2582271
{col 1}{text}       _cons{col 14}{c |}{result}{space 2}-.2042386{col 26}{space 2} .1318372{col 37}{space 1}   -1.55{col 46}{space 3}0.121{col 55}{space 3}-.4626347{col 67}{space 3} .0541575
{col 1}{text}{hline 13}{c +}{hline 11}{hline 11}{hline 9}{hline 9}{hline 12}{hline 12}
{col 1}{text}    /lnalpha{col 14}{c |}{result}{space 2}-2.027727{col 27}{space 1} .4066709{col 55}{space 3}-2.824787{col 67}{space 3}-1.230667
{col 1}{text}{hline 13}{c +}{hline 12}{hline 12}{hline 8}{hline 8}{hline 12}{hline 12}
{col 1}{text}       alpha{col 14}{c |}{result}{space 2} .1316344{col 27}{space 1} .0535319{col 55}{space 3} .0593213{col 67}{space 3} .2920977
{col 1}{text}{hline 13}{c BT}{hline 11}{hline 11}{hline 9}{hline 9}{hline 12}{hline 12}

{com}. test

{txt} ( 1)  {res}[mCasualty]L.lmCasualty = 0
{txt} ( 2)  {res}[mCasualty]L2.lmCasualty = 0
{txt} ( 3)  {res}[mCasualty]FUND = 0
{txt} ( 4)  {res}[mCasualty]POST = 0
{txt} ( 5)  {res}[mCasualty]SEPT = 0
{txt} ( 6)  {res}[mCasualty]Dp = 0
{txt} ( 7)  {res}[mCasualty]IRAQ = 0

           {txt}chi2(  7) ={res}  340.74
         {txt}Prob > chi2 ={res}    0.0000

{txt}
{com}. predict double mCasualty_pred
{txt}(option n assumed; predicted number of events)
(2 missing values generated)

{com}. line mCasualty mCasualty_pred Quarter
{res}{txt}
{com}. 
. *Testing null that 9/11 did have no impact on terrorism patterns (for F column)
. test SEPT Dp

{txt} ( 1)  {res}[mCasualty]SEPT = 0
{txt} ( 2)  {res}[mCasualty]Dp = 0

{txt}{col 12}chi2(  2) ={res}   43.35
{txt}{col 10}Prob > chi2 =  {res}  0.0000
{txt}
{com}. * Ljung-Box statistic Q(4) - testing H0: white noise(in residuals)--> the first 4 autocorrelations are jointly insignificant
. *** Predicting Pearson residuals
. scalar s2 = exp(_b[/lnalpha]) 
{txt}
{com}. gen nbresidual = (mCasualty-mCasualty_pred)/sqrt( mCasualty_pred*(1+mCasualty_pred*s2) )
{txt}(2 missing values generated)

{com}. wntestq nbresidual, lags(4)

{txt}Portmanteau test for white noise
{hline 39}
 Portmanteau (Q) statistic = {res}    4.6344
{txt} Prob > chi2({res}4{txt})            = {res}    0.3269
{txt}
{com}. drop nbresidual mCasualty_pred
{txt}
{com}. 
. * Which one is better fit? Based on AIC and BIC
. qui nbreg mCasualty L(1/2).lmCasualty FUND POST SEPT Dp IRAQ, robust
{txt}
{com}. estat ic

{txt}{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  158{col 25} -389.673{col 37}-319.8583{col 48}    8{col 57} 655.7165{col 69} 680.2173
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{com}. qui regress mCasualty L(1/2).mCasualty FUND POST SEPT Dp IRAQ, robust
{txt}
{com}. estat ic

{txt}{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  158{col 25}-433.4473{col 37}-367.9803{col 48}    7{col 57} 749.9606{col 69} 771.3988
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{com}. qui nbreg mCasualty L(1/2).mCasualty FUND POST SEPT Dp IRAQ, robust
{txt}
{com}. estat ic

{txt}{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  158{col 25} -389.673{col 37}-325.5703{col 48}    8{col 57} 667.1406{col 69} 691.6414
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{com}. qui poisson mCasualty L(1/2).mCasualty FUND POST SEPT Dp IRAQ, robust
{txt}
{com}. estat ic

{txt}{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  158{col 25}-498.6688{col 37}-337.1742{col 48}    7{col 57} 688.3484{col 69} 709.7866
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{com}. drop ystar lmCasualty
{txt}
{com}. 
. *ITERATE
. sum iCasualty

{txt}    Variable {c |}       Obs        Mean    Std. Dev.       Min        Max
{hline 13}{c +}{hline 56}
   iCasualty {c |}{res}       160     4.84375    5.314685          0         30
{txt}
{com}. tab Quarter if iCasualty==0

    {txt}Quarter {c |}      Freq.     Percent        Cum.
{hline 12}{c +}{hline 35}
     1968:1 {c |}{res}          1        6.25        6.25
{txt}     1968:2 {c |}{res}          1        6.25       12.50
{txt}     1968:3 {c |}{res}          1        6.25       18.75
{txt}     1968:4 {c |}{res}          1        6.25       25.00
{txt}     1969:4 {c |}{res}          1        6.25       31.25
{txt}     1970:3 {c |}{res}          1        6.25       37.50
{txt}     1971:4 {c |}{res}          1        6.25       43.75
{txt}     1972:1 {c |}{res}          1        6.25       50.00
{txt}     1973:2 {c |}{res}          1        6.25       56.25
{txt}     1973:3 {c |}{res}          1        6.25       62.50
{txt}     1974:3 {c |}{res}          1        6.25       68.75
{txt}     1975:1 {c |}{res}          1        6.25       75.00
{txt}     1975:2 {c |}{res}          1        6.25       81.25
{txt}     1980:3 {c |}{res}          1        6.25       87.50
{txt}     1981:4 {c |}{res}          1        6.25       93.75
{txt}     1990:2 {c |}{res}          1        6.25      100.00
{txt}{hline 12}{c +}{hline 35}
      Total {c |}{res}         16      100.00
{txt}
{com}. forvalues i=1/8 {c -(}
{txt}  2{com}. qui arima iCasualty, ar(1/`i')
{txt}  3{com}. estat ic
{txt}  4{com}. {c )-}

{txt}{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  160{col 25}        .{col 37}-461.9768{col 48}    3{col 57} 929.9536{col 69} 939.1791
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  160{col 25}        .{col 37}-451.8905{col 48}    4{col 57}  911.781{col 69} 924.0817
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  160{col 25}        .{col 37}-451.8377{col 48}    5{col 57} 913.6754{col 69} 929.0512
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  160{col 25}        .{col 37}-449.8513{col 48}    6{col 57} 911.7027{col 69} 930.1537
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  160{col 25}        .{col 37}-449.5867{col 48}    7{col 57} 913.1735{col 69} 934.6997
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  160{col 25}        .{col 37}-449.4305{col 48}    8{col 57}  914.861{col 69} 939.4624
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  160{col 25}        .{col 37}-447.5007{col 48}    9{col 57} 913.0013{col 69} 940.6779
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  160{col 25}        .{col 37}-447.4552{col 48}   10{col 57} 914.9103{col 69} 945.6621
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{com}. 
. * Choosing model AR(4) according to AIC and AR(2) according to BIC
. * Parsimonity --> estimating AR(2)
. 
. regress iCasualty L(1/2).iCasualty FUND POST SEPT Dp IRAQ, robust

{txt}Linear regression                                      Number of obs ={res}     158
                                                       {help j_robustsingular:F(  6,   150) =}       .
                                                       {txt}Prob > F      = {res}      .
                                                       {txt}R-squared     = {res} 0.4522
                                                       {txt}Root MSE      = {res} 4.0283

{txt}{hline 13}{c TT}{hline 64}
             {c |}               Robust
   iCasualty {c |}      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
{hline 13}{char +}{hline 64}
   iCasualty {c |}
         L1. {c |}  {res} .2698892   .1572391     1.72   0.088    -.0408004    .5805788
         {txt}L2. {c |}  {res} .2425116   .1554601     1.56   0.121     -.064663    .5496861
        {txt}FUND {c |}  {res}  1.17526   .7554941     1.56   0.122    -.3175251    2.668045
        {txt}POST {c |}  {res} 2.789124   1.175496     2.37   0.019     .4664557    5.111793
        {txt}SEPT {c |}  {res}-1.565036   1.484362    -1.05   0.293    -4.497996    1.367923
          {txt}Dp {c |}  {res}-2.733604   1.231024    -2.22   0.028    -5.165991    -.301216
        {txt}IRAQ {c |}  {res}-.9933339   1.201625    -0.83   0.410     -3.36763    1.380963
       {txt}_cons {c |}  {res} .8218553   .3419262     2.40   0.017     .1462415    1.497469
{txt}{hline 13}{c BT}{hline 64}

{com}. 
. predict double iCasualty_pred
{txt}(option xb assumed; fitted values)
(2 missing values generated)

{com}. line iCasualty iCasualty_pred Quarter
{res}{txt}
{com}. drop iCasualty_pred
{txt}
{com}. 
. *Testing null that 9/11 did have no impact on terrorism patterns (for F column)
. test SEPT Dp

{txt} ( 1)  {res}SEPT = 0
{txt} ( 2)  {res}Dp = 0

{txt}       F(  2,   150) ={res}    4.64
{txt}{col 13}Prob > F ={res}    0.0111
{txt}
{com}. 
. * Ljung-Box statistic Q(4) - testing H0: white noise(in residuals)--> the first 4 autocorrelations are jointly insignificant
. predict double resid, residual
{txt}(2 missing values generated)

{com}. wntestq resid, lags(4)

{txt}Portmanteau test for white noise
{hline 39}
 Portmanteau (Q) statistic = {res}    4.5003
{txt} Prob > chi2({res}4{txt})            = {res}    0.3425
{txt}
{com}. drop resid
{txt}
{com}. 
. *Negative binomial
. count if iCasualty==0
{res}   16
{txt}
{com}. *16 zero observations - grid search to find c ==> c=0.02
. gen ystar=iCasualty
{txt}
{com}. replace ystar=0.02 if iCasualty==0
{txt}(16 real changes made)

{com}. gen liCasualty=ln(ystar)
{txt}
{com}. nbreg iCasualty L(1/2).liCasualty FUND POST SEPT Dp IRAQ, robust

{txt}Fitting Poisson model:

Iteration 0:{col 16}log pseudolikelihood = {res}-414.13693{txt}  
Iteration 1:{col 16}log pseudolikelihood = {res}-413.78918{txt}  
Iteration 2:{col 16}log pseudolikelihood = {res}-413.78884{txt}  
Iteration 3:{col 16}log pseudolikelihood = {res}-413.78884{txt}  

Fitting constant-only model:

Iteration 0:{col 16}log pseudolikelihood = {res}-424.37319{txt}  
Iteration 1:{col 16}log pseudolikelihood = {res}-422.31372{txt}  
Iteration 2:{col 16}log pseudolikelihood = {res}-422.31367{txt}  
Iteration 3:{col 16}log pseudolikelihood = {res}-422.31367{txt}  

Fitting full model:

Iteration 0:{col 16}log pseudolikelihood = {res}-387.73858{txt}  
Iteration 1:{col 16}log pseudolikelihood = {res}-369.60592{txt}  
Iteration 2:{col 16}log pseudolikelihood = {res}-367.46337{txt}  
Iteration 3:{col 16}log pseudolikelihood = {res}-367.43655{txt}  
Iteration 4:{col 16}log pseudolikelihood = {res}-367.43654{txt}  

Negative binomial regression                      Number of obs   =  {res}      158
{txt}Dispersion           = {res}mean                       {txt}Wald chi2({res}6{txt})    =  {res}        .
{txt}Log pseudolikelihood = {res}-367.43654                 {txt}Prob > chi2     =  {res}        .

{col 1}{text}{hline 13}{c TT}{hline 11}{hline 11}{hline 9}{hline 9}{hline 12}{hline 12}
{col 14}{text}{c |}{col 26}    Robust
{col 1}{text}   iCasualty{col 14}{c |}      Coef.{col 26}   Std. Err.{col 37}      z{col 46}   P>|z|{col 55}    [95% Conf. Interval]
{col 1}{text}{hline 13}{c +}{hline 11}{hline 11}{hline 9}{hline 9}{hline 12}{hline 12}
{col 1}{text}  liCasualty{col 14}{c |}
{col 1}{text}         L1.{col 14}{c |}{result}{space 2}  .212198{col 26}{space 2} .0550016{col 37}{space 1}    3.86{col 46}{space 3}0.000{col 55}{space 3} .1043968{col 67}{space 3} .3199991
{col 1}{text}         L2.{col 14}{c |}{result}{space 2} .0340054{col 26}{space 2} .0406412{col 37}{space 1}    0.84{col 46}{space 3}0.403{col 55}{space 3}-.0456499{col 67}{space 3} .1136607
{col 1}{text}        FUND{col 14}{c |}{result}{space 2} .6517758{col 26}{space 2} .1879689{col 37}{space 1}    3.47{col 46}{space 3}0.001{col 55}{space 3} .2833635{col 67}{space 3} 1.020188
{col 1}{text}        POST{col 14}{c |}{result}{space 2} .6259186{col 26}{space 2} .1543418{col 37}{space 1}    4.06{col 46}{space 3}0.000{col 55}{space 3} .3234142{col 67}{space 3}  .928423
{col 1}{text}        SEPT{col 14}{c |}{result}{space 2}-.4021894{col 26}{space 2} .2008067{col 37}{space 1}   -2.00{col 46}{space 3}0.045{col 55}{space 3}-.7957632{col 67}{space 3}-.0086156
{col 1}{text}          Dp{col 14}{c |}{result}{space 2}-1.373027{col 26}{space 2} .1801466{col 37}{space 1}   -7.62{col 46}{space 3}0.000{col 55}{space 3}-1.726108{col 67}{space 3}-1.019946
{col 1}{text}        IRAQ{col 14}{c |}{result}{space 2} -.160896{col 26}{space 2} .2040876{col 37}{space 1}   -0.79{col 46}{space 3}0.430{col 55}{space 3}-.5609004{col 67}{space 3} .2391085
{col 1}{text}       _cons{col 14}{c |}{result}{space 2} .4975222{col 26}{space 2} .1387048{col 37}{space 1}    3.59{col 46}{space 3}0.000{col 55}{space 3} .2256658{col 67}{space 3} .7693786
{col 1}{text}{hline 13}{c +}{hline 11}{hline 11}{hline 9}{hline 9}{hline 12}{hline 12}
{col 1}{text}    /lnalpha{col 14}{c |}{result}{space 2}-1.322901{col 27}{space 1} .1862085{col 55}{space 3}-1.687862{col 67}{space 3}-.9579386
{col 1}{text}{hline 13}{c +}{hline 12}{hline 12}{hline 8}{hline 8}{hline 12}{hline 12}
{col 1}{text}       alpha{col 14}{c |}{result}{space 2} .2663616{col 27}{space 1} .0495988{col 55}{space 3} .1849144{col 67}{space 3}  .383683
{col 1}{text}{hline 13}{c BT}{hline 11}{hline 11}{hline 9}{hline 9}{hline 12}{hline 12}

{com}. test

{txt} ( 1)  {res}[iCasualty]L.liCasualty = 0
{txt} ( 2)  {res}[iCasualty]L2.liCasualty = 0
{txt} ( 3)  {res}[iCasualty]FUND = 0
{txt} ( 4)  {res}[iCasualty]POST = 0
{txt} ( 5)  {res}[iCasualty]SEPT = 0
{txt} ( 6)  {res}[iCasualty]Dp = 0
{txt} ( 7)  {res}[iCasualty]IRAQ = 0

           {txt}chi2(  7) ={res}  944.72
         {txt}Prob > chi2 ={res}    0.0000

{txt}
{com}. predict double iCasualty_pred
{txt}(option n assumed; predicted number of events)
(2 missing values generated)

{com}. line iCasualty iCasualty_pred Quarter
{res}{txt}
{com}. 
. *Testing null that 9/11 did have no impact on terrorism patterns (for F column)
. test SEPT Dp

{txt} ( 1)  {res}[iCasualty]SEPT = 0
{txt} ( 2)  {res}[iCasualty]Dp = 0

{txt}{col 12}chi2(  2) ={res}  146.67
{txt}{col 10}Prob > chi2 =  {res}  0.0000
{txt}
{com}. * Ljung-Box statistic Q(4) - testing H0: white noise(in residuals)--> the first 4 autocorrelations are jointly insignificant
. *** Predicting Pearson residuals
. scalar s2 = exp(_b[/lnalpha]) 
{txt}
{com}. gen nbresidual = (iCasualty-iCasualty_pred)/sqrt( iCasualty_pred*(1+iCasualty_pred*s2) )
{txt}(2 missing values generated)

{com}. wntestq nbresidual, lags(4)

{txt}Portmanteau test for white noise
{hline 39}
 Portmanteau (Q) statistic = {res}    2.3412
{txt} Prob > chi2({res}4{txt})            = {res}    0.6733
{txt}
{com}. drop nbresidual iCasualty_pred
{txt}
{com}. 
. * Which one is better fit? Based on AIC and BIC
. qui nbreg iCasualty L(1/2).liCasualty FUND POST SEPT Dp IRAQ, robust
{txt}
{com}. estat ic

{txt}{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  158{col 25}-422.3137{col 37}-367.4365{col 48}    8{col 57} 750.8731{col 69} 775.3738
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{com}. qui regress iCasualty L(1/2).iCasualty FUND POST SEPT Dp IRAQ, robust
{txt}
{com}. estat ic

{txt}{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  158{col 25}-487.7852{col 37}-440.2378{col 48}    7{col 57} 894.4757{col 69} 915.9139
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{com}. qui nbreg iCasualty L(1/2).iCasualty FUND POST SEPT Dp IRAQ, robust
{txt}
{com}. estat ic

{txt}{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  158{col 25}-422.3137{col 37}-368.0699{col 48}    8{col 57} 752.1398{col 69} 776.6406
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{com}. qui poisson iCasualty L(1/2).iCasualty FUND POST SEPT Dp IRAQ, robust
{txt}
{com}. estat ic

{txt}{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  158{col 25} -591.778{col 37}-412.7123{col 48}    7{col 57} 839.4246{col 69} 860.8628
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{com}. drop ystar liCasualty
{txt}
{com}. 
. *** US target incidents
. 
. *MIPT
. sum mUS_Target

{txt}    Variable {c |}       Obs        Mean    Std. Dev.       Min        Max
{hline 13}{c +}{hline 56}
  mUS_Target {c |}{res}       160      1.5625    1.821215          0         10
{txt}
{com}. tab Quarter if mUS_Target==0

    {txt}Quarter {c |}      Freq.     Percent        Cum.
{hline 12}{c +}{hline 35}
     1968:1 {c |}{res}          1        1.79        1.79
{txt}     1968:2 {c |}{res}          1        1.79        3.57
{txt}     1968:3 {c |}{res}          1        1.79        5.36
{txt}     1968:4 {c |}{res}          1        1.79        7.14
{txt}     1969:1 {c |}{res}          1        1.79        8.93
{txt}     1969:2 {c |}{res}          1        1.79       10.71
{txt}     1969:4 {c |}{res}          1        1.79       12.50
{txt}     1970:3 {c |}{res}          1        1.79       14.29
{txt}     1972:1 {c |}{res}          1        1.79       16.07
{txt}     1972:2 {c |}{res}          1        1.79       17.86
{txt}     1972:4 {c |}{res}          1        1.79       19.64
{txt}     1973:2 {c |}{res}          1        1.79       21.43
{txt}     1973:3 {c |}{res}          1        1.79       23.21
{txt}     1974:3 {c |}{res}          1        1.79       25.00
{txt}     1976:3 {c |}{res}          1        1.79       26.79
{txt}     1976:4 {c |}{res}          1        1.79       28.57
{txt}     1977:3 {c |}{res}          1        1.79       30.36
{txt}     1978:1 {c |}{res}          1        1.79       32.14
{txt}     1978:3 {c |}{res}          1        1.79       33.93
{txt}     1978:4 {c |}{res}          1        1.79       35.71
{txt}     1979:2 {c |}{res}          1        1.79       37.50
{txt}     1979:4 {c |}{res}          1        1.79       39.29
{txt}     1980:1 {c |}{res}          1        1.79       41.07
{txt}     1980:2 {c |}{res}          1        1.79       42.86
{txt}     1980:3 {c |}{res}          1        1.79       44.64
{txt}     1980:4 {c |}{res}          1        1.79       46.43
{txt}     1981:1 {c |}{res}          1        1.79       48.21
{txt}     1981:2 {c |}{res}          1        1.79       50.00
{txt}     1981:3 {c |}{res}          1        1.79       51.79
{txt}     1981:4 {c |}{res}          1        1.79       53.57
{txt}     1982:2 {c |}{res}          1        1.79       55.36
{txt}     1982:3 {c |}{res}          1        1.79       57.14
{txt}     1982:4 {c |}{res}          1        1.79       58.93
{txt}     1983:3 {c |}{res}          1        1.79       60.71
{txt}     1983:4 {c |}{res}          1        1.79       62.50
{txt}     1985:2 {c |}{res}          1        1.79       64.29
{txt}     1985:4 {c |}{res}          1        1.79       66.07
{txt}     1986:4 {c |}{res}          1        1.79       67.86
{txt}     1987:1 {c |}{res}          1        1.79       69.64
{txt}     1988:4 {c |}{res}          1        1.79       71.43
{txt}     1990:3 {c |}{res}          1        1.79       73.21
{txt}     1990:4 {c |}{res}          1        1.79       75.00
{txt}     1991:4 {c |}{res}          1        1.79       76.79
{txt}     1992:2 {c |}{res}          1        1.79       78.57
{txt}     1995:4 {c |}{res}          1        1.79       80.36
{txt}     1997:3 {c |}{res}          1        1.79       82.14
{txt}     1998:1 {c |}{res}          1        1.79       83.93
{txt}     1999:2 {c |}{res}          1        1.79       85.71
{txt}     1999:4 {c |}{res}          1        1.79       87.50
{txt}     2000:1 {c |}{res}          1        1.79       89.29
{txt}     2000:2 {c |}{res}          1        1.79       91.07
{txt}     2005:1 {c |}{res}          1        1.79       92.86
{txt}     2005:2 {c |}{res}          1        1.79       94.64
{txt}     2007:2 {c |}{res}          1        1.79       96.43
{txt}     2007:3 {c |}{res}          1        1.79       98.21
{txt}     2007:4 {c |}{res}          1        1.79      100.00
{txt}{hline 12}{c +}{hline 35}
      Total {c |}{res}         56      100.00
{txt}
{com}. forvalues i=1/8 {c -(}
{txt}  2{com}. qui arima mUS_Target, ar(1/`i')
{txt}  3{com}. estat ic
{txt}  4{com}. {c )-}

{txt}{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  160{col 25}        .{col 37}-318.7492{col 48}    3{col 57} 643.4985{col 69}  652.724
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  160{col 25}        .{col 37}-313.8413{col 48}    4{col 57} 635.6827{col 69} 647.9834
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  160{col 25}        .{col 37}-313.2993{col 48}    5{col 57} 636.5985{col 69} 651.9744
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  160{col 25}        .{col 37}-312.2072{col 48}    6{col 57} 636.4145{col 69} 654.8655
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  160{col 25}        .{col 37}-312.1319{col 48}    7{col 57} 638.2637{col 69} 659.7899
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  160{col 25}        .{col 37}-312.1121{col 48}    8{col 57} 640.2243{col 69} 664.8256
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  160{col 25}        .{col 37}-312.1006{col 48}    9{col 57} 642.2012{col 69} 669.8778
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  160{col 25}        .{col 37}-311.2805{col 48}   10{col 57} 642.5611{col 69} 673.3128
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{com}. 
. * Choosing model AR(2) according to AIC and AR(2) according to BIC
. * Estimating AR(2)
. 
. regress mUS_Target L(1/2).mUS_Target FUND POST SEPT Dp IRAQ, robust

{txt}Linear regression                                      Number of obs ={res}     158
                                                       {help j_robustsingular:F(  6,   150) =}       .
                                                       {txt}Prob > F      = {res}      .
                                                       {txt}R-squared     = {res} 0.1754
                                                       {txt}Root MSE      = {res} 1.6946

{txt}{hline 13}{c TT}{hline 64}
             {c |}               Robust
  mUS_Target {c |}      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
{hline 13}{char +}{hline 64}
  mUS_Target {c |}
         L1. {c |}  {res} .0580461   .0912989     0.64   0.526     -.122352    .2384441
         {txt}L2. {c |}  {res} .1381633   .0939646     1.47   0.144    -.0475018    .3238285
        {txt}FUND {c |}  {res} .0657101   .2712145     0.24   0.809    -.4701842    .6016043
        {txt}POST {c |}  {res} 1.210927   .4454804     2.72   0.007        .3307    2.091154
        {txt}SEPT {c |}  {res} .2590787   .7671791     0.34   0.736    -1.256795    1.774952
          {txt}Dp {c |}  {res} .2056685   .6493052     0.32   0.752    -1.077297    1.488634
        {txt}IRAQ {c |}  {res}-1.033692   .7711911    -1.34   0.182    -2.557493    .4901082
       {txt}_cons {c |}  {res} .8081508   .2417843     3.34   0.001     .3304079    1.285894
{txt}{hline 13}{c BT}{hline 64}

{com}. 
. predict double mUS_Target_pred
{txt}(option xb assumed; fitted values)
(2 missing values generated)

{com}. line mUS_Target mUS_Target_pred Quarter
{res}{txt}
{com}. drop mUS_Target_pred
{txt}
{com}. 
. *Testing null that 9/11 did have no impact on terrorism patterns (for F column)
. test SEPT Dp

{txt} ( 1)  {res}SEPT = 0
{txt} ( 2)  {res}Dp = 0

{txt}       F(  2,   150) ={res}    0.75
{txt}{col 13}Prob > F ={res}    0.4751
{txt}
{com}. 
. * Ljung-Box statistic Q(4) - testing H0: white noise(in residuals)--> the first 4 autocorrelations are jointly insignificant
. predict double resid, residual
{txt}(2 missing values generated)

{com}. wntestq resid, lags(4)

{txt}Portmanteau test for white noise
{hline 39}
 Portmanteau (Q) statistic = {res}    0.3513
{txt} Prob > chi2({res}4{txt})            = {res}    0.9863
{txt}
{com}. drop resid
{txt}
{com}. 
. *Negative binomial
. count if mUS_Target==0
{res}   56
{txt}
{com}. *16 zero observations - grid search to find c ==> c=0.99
. gen ystar=mUS_Target
{txt}
{com}. replace ystar=0.99 if mUS_Target==0
{txt}(56 real changes made)

{com}. gen lmUS_Target=ln(ystar)
{txt}
{com}. nbreg mUS_Target L(1/2).lmUS_Target FUND POST SEPT Dp IRAQ, robust

{txt}Fitting Poisson model:

Iteration 0:{col 16}log pseudolikelihood = {res}-269.65397{txt}  
Iteration 1:{col 16}log pseudolikelihood = {res}-269.65206{txt}  
Iteration 2:{col 16}log pseudolikelihood = {res}-269.65206{txt}  

Fitting constant-only model:

Iteration 0:{col 16}log pseudolikelihood = {res}-272.34176{txt}  
Iteration 1:{col 16}log pseudolikelihood = {res} -271.2818{txt}  
Iteration 2:{col 16}log pseudolikelihood = {res} -271.2818{txt}  

Fitting full model:

Iteration 0:{col 16}log pseudolikelihood = {res}   -260.37{txt}  
Iteration 1:{col 16}log pseudolikelihood = {res}-258.40999{txt}  
Iteration 2:{col 16}log pseudolikelihood = {res}-258.33221{txt}  
Iteration 3:{col 16}log pseudolikelihood = {res}-258.33215{txt}  
Iteration 4:{col 16}log pseudolikelihood = {res}-258.33215{txt}  

Negative binomial regression                      Number of obs   =  {res}      158
{txt}Dispersion           = {res}mean                       {txt}Wald chi2({res}6{txt})    =  {res}        .
{txt}Log pseudolikelihood = {res}-258.33215                 {txt}Prob > chi2     =  {res}        .

{col 1}{text}{hline 13}{c TT}{hline 11}{hline 11}{hline 9}{hline 9}{hline 12}{hline 12}
{col 14}{text}{c |}{col 26}    Robust
{col 1}{text}  mUS_Target{col 14}{c |}      Coef.{col 26}   Std. Err.{col 37}      z{col 46}   P>|z|{col 55}    [95% Conf. Interval]
{col 1}{text}{hline 13}{c +}{hline 11}{hline 11}{hline 9}{hline 9}{hline 12}{hline 12}
{col 1}{text} lmUS_Target{col 14}{c |}
{col 1}{text}         L1.{col 14}{c |}{result}{space 2} .0611248{col 26}{space 2} .1319891{col 37}{space 1}    0.46{col 46}{space 3}0.643{col 55}{space 3}-.1975691{col 67}{space 3} .3198187
{col 1}{text}         L2.{col 14}{c |}{result}{space 2} .1663215{col 26}{space 2} .1354334{col 37}{space 1}    1.23{col 46}{space 3}0.219{col 55}{space 3}-.0991232{col 67}{space 3} .4317661
{col 1}{text}        FUND{col 14}{c |}{result}{space 2} .0712646{col 26}{space 2} .2560399{col 37}{space 1}    0.28{col 46}{space 3}0.781{col 55}{space 3}-.4305644{col 67}{space 3} .5730935
{col 1}{text}        POST{col 14}{c |}{result}{space 2} .7447653{col 26}{space 2} .2465405{col 37}{space 1}    3.02{col 46}{space 3}0.003{col 55}{space 3} .2615549{col 67}{space 3} 1.227976
{col 1}{text}        SEPT{col 14}{c |}{result}{space 2} .0865914{col 26}{space 2} .2555357{col 37}{space 1}    0.34{col 46}{space 3}0.735{col 55}{space 3}-.4142494{col 67}{space 3} .5874323
{col 1}{text}          Dp{col 14}{c |}{result}{space 2} .0664531{col 26}{space 2} .2119496{col 37}{space 1}    0.31{col 46}{space 3}0.754{col 55}{space 3}-.3489604{col 67}{space 3} .4818666
{col 1}{text}        IRAQ{col 14}{c |}{result}{space 2}-.4443414{col 26}{space 2} .3235481{col 37}{space 1}   -1.37{col 46}{space 3}0.170{col 55}{space 3}-1.078484{col 67}{space 3} .1898011
{col 1}{text}       _cons{col 14}{c |}{result}{space 2}-.0528999{col 26}{space 2} .1942131{col 37}{space 1}   -0.27{col 46}{space 3}0.785{col 55}{space 3}-.4335504{col 67}{space 3} .3277507
{col 1}{text}{hline 13}{c +}{hline 11}{hline 11}{hline 9}{hline 9}{hline 12}{hline 12}
{col 1}{text}    /lnalpha{col 14}{c |}{result}{space 2}-.8273967{col 27}{space 1} .2984501{col 55}{space 3}-1.412348{col 67}{space 3}-.2424453
{col 1}{text}{hline 13}{c +}{hline 12}{hline 12}{hline 8}{hline 8}{hline 12}{hline 12}
{col 1}{text}       alpha{col 14}{c |}{result}{space 2} .4371859{col 27}{space 1} .1304782{col 55}{space 3} .2435707{col 67}{space 3} .7847067
{col 1}{text}{hline 13}{c BT}{hline 11}{hline 11}{hline 9}{hline 9}{hline 12}{hline 12}

{com}. test

{txt} ( 1)  {res}[mUS_Target]L.lmUS_Target = 0
{txt} ( 2)  {res}[mUS_Target]L2.lmUS_Target = 0
{txt} ( 3)  {res}[mUS_Target]FUND = 0
{txt} ( 4)  {res}[mUS_Target]POST = 0
{txt} ( 5)  {res}[mUS_Target]SEPT = 0
{txt} ( 6)  {res}[mUS_Target]Dp = 0
{txt} ( 7)  {res}[mUS_Target]IRAQ = 0

           {txt}chi2(  7) ={res}   77.07
         {txt}Prob > chi2 ={res}    0.0000

{txt}
{com}. predict double mUS_Target_pred
{txt}(option n assumed; predicted number of events)
(2 missing values generated)

{com}. line mUS_Target mUS_Target_pred Quarter
{res}{txt}
{com}. 
. *Testing null that 9/11 did have no impact on terrorism patterns (for F column)
. test SEPT Dp

{txt} ( 1)  {res}[mUS_Target]SEPT = 0
{txt} ( 2)  {res}[mUS_Target]Dp = 0

{txt}{col 12}chi2(  2) ={res}    1.00
{txt}{col 10}Prob > chi2 =  {res}  0.6060
{txt}
{com}. * Ljung-Box statistic Q(4) - testing H0: white noise(in residuals)--> the first 4 autocorrelations are jointly insignificant
. *** Predicting Pearson residuals
. scalar s2 = exp(_b[/lnalpha]) 
{txt}
{com}. gen nbresidual = (mUS_Target-mUS_Target_pred)/sqrt( mUS_Target_pred*(1+mUS_Target_pred*s2) )
{txt}(2 missing values generated)

{com}. wntestq nbresidual, lags(4)

{txt}Portmanteau test for white noise
{hline 39}
 Portmanteau (Q) statistic = {res}    0.8417
{txt} Prob > chi2({res}4{txt})            = {res}    0.9328
{txt}
{com}. drop nbresidual mUS_Target_pred
{txt}
{com}. 
. * Which one is better fit? Based on AIC and BIC
. qui nbreg mUS_Target L(1/2).lmUS_Target FUND POST SEPT Dp IRAQ, robust
{txt}
{com}. estat ic

{txt}{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  158{col 25}-271.2818{col 37}-258.3322{col 48}    8{col 57} 532.6643{col 69} 557.1651
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{com}. qui regress mUS_Target L(1/2).mUS_Target FUND POST SEPT Dp IRAQ, robust
{txt}
{com}. estat ic

{txt}{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  158{col 25}-318.6681{col 37}-303.4285{col 48}    7{col 57}  620.857{col 69} 642.2952
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{com}. qui nbreg mUS_Target L(1/2).mUS_Target FUND POST SEPT Dp IRAQ, robust
{txt}
{com}. estat ic

{txt}{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  158{col 25}-271.2818{col 37}-258.0368{col 48}    8{col 57} 532.0735{col 69} 556.5743
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{com}. qui poisson mUS_Target L(1/2).mUS_Target FUND POST SEPT Dp IRAQ, robust
{txt}
{com}. estat ic

{txt}{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  158{col 25}-295.8676{col 37}-269.4018{col 48}    7{col 57} 552.8037{col 69} 574.2418
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{com}. drop ystar lmUS_Target
{txt}
{com}. 
. *ITERATE
. sum iUS_Target

{txt}    Variable {c |}       Obs        Mean    Std. Dev.       Min        Max
{hline 13}{c +}{hline 56}
  iUS_Target {c |}{res}       160     2.90625    3.595589          0         22
{txt}
{com}. tab Quarter if iCasualty==0

    {txt}Quarter {c |}      Freq.     Percent        Cum.
{hline 12}{c +}{hline 35}
     1968:1 {c |}{res}          1        6.25        6.25
{txt}     1968:2 {c |}{res}          1        6.25       12.50
{txt}     1968:3 {c |}{res}          1        6.25       18.75
{txt}     1968:4 {c |}{res}          1        6.25       25.00
{txt}     1969:4 {c |}{res}          1        6.25       31.25
{txt}     1970:3 {c |}{res}          1        6.25       37.50
{txt}     1971:4 {c |}{res}          1        6.25       43.75
{txt}     1972:1 {c |}{res}          1        6.25       50.00
{txt}     1973:2 {c |}{res}          1        6.25       56.25
{txt}     1973:3 {c |}{res}          1        6.25       62.50
{txt}     1974:3 {c |}{res}          1        6.25       68.75
{txt}     1975:1 {c |}{res}          1        6.25       75.00
{txt}     1975:2 {c |}{res}          1        6.25       81.25
{txt}     1980:3 {c |}{res}          1        6.25       87.50
{txt}     1981:4 {c |}{res}          1        6.25       93.75
{txt}     1990:2 {c |}{res}          1        6.25      100.00
{txt}{hline 12}{c +}{hline 35}
      Total {c |}{res}         16      100.00
{txt}
{com}. forvalues i=1/8 {c -(}
{txt}  2{com}. qui arima iUS_Target, ar(1/`i')
{txt}  3{com}. estat ic
{txt}  4{com}. {c )-}

{txt}{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  160{col 25}        .{col 37} -429.036{col 48}    3{col 57} 864.0719{col 69} 873.2974
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  160{col 25}        .{col 37}-422.6354{col 48}    4{col 57} 853.2708{col 69} 865.5715
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  160{col 25}        .{col 37}-421.5855{col 48}    5{col 57} 853.1709{col 69} 868.5468
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  160{col 25}        .{col 37}-420.9106{col 48}    6{col 57} 853.8212{col 69} 872.2723
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  160{col 25}        .{col 37}-420.8992{col 48}    7{col 57} 855.7984{col 69} 877.3246
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  160{col 25}        .{col 37}-420.7237{col 48}    8{col 57} 857.4474{col 69} 882.0488
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  160{col 25}        .{col 37}-420.5897{col 48}    9{col 57} 859.1795{col 69}  886.856
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  160{col 25}        .{col 37}-418.3343{col 48}   10{col 57} 856.6685{col 69} 887.4203
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{com}. 
. * Choosing model AR(3) according to AIC and AR(2) according to BIC
. * Estimating AR(2)
. 
. regress iUS_Target L(1/2).iUS_Target FUND POST SEPT Dp IRAQ, robust

{txt}Linear regression                                      Number of obs ={res}     158
                                                       {help j_robustsingular:F(  6,   150) =}       .
                                                       {txt}Prob > F      = {res}      .
                                                       {txt}R-squared     = {res} 0.2293
                                                       {txt}Root MSE      = {res} 3.2364

{txt}{hline 13}{c TT}{hline 64}
             {c |}               Robust
  iUS_Target {c |}      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
{hline 13}{char +}{hline 64}
  iUS_Target {c |}
         L1. {c |}  {res} .0205562   .0739833     0.28   0.782    -.1256277    .1667401
         {txt}L2. {c |}  {res} .1972045   .0890837     2.21   0.028     .0211836    .3732255
        {txt}FUND {c |}  {res} .1839057   .5570203     0.33   0.742    -.9167138    1.284525
        {txt}POST {c |}  {res} 2.147574   .8339171     2.58   0.011     .4998331    3.795315
        {txt}SEPT {c |}  {res} 3.074603   2.396243     1.28   0.201    -1.660147    7.809353
          {txt}Dp {c |}  {res}-7.464222   2.243006    -3.33   0.001    -11.89619   -3.032255
        {txt}IRAQ {c |}  {res} -5.08686   2.317908    -2.19   0.030    -9.666826   -.5068939
       {txt}_cons {c |}  {res} 1.425414    .409307     3.48   0.001      .616662    2.234166
{txt}{hline 13}{c BT}{hline 64}

{com}. 
. predict double iUS_Target_pred
{txt}(option xb assumed; fitted values)
(2 missing values generated)

{com}. line iUS_Target iUS_Target_pred Quarter
{res}{txt}
{com}. drop iUS_Target_pred
{txt}
{com}. 
. *Testing null that 9/11 did have no impact on terrorism patterns (for F column)
. test SEPT Dp

{txt} ( 1)  {res}SEPT = 0
{txt} ( 2)  {res}Dp = 0

{txt}       F(  2,   150) ={res}   26.38
{txt}{col 13}Prob > F ={res}    0.0000
{txt}
{com}. 
. * Ljung-Box statistic Q(4) - testing H0: white noise(in residuals)--> the first 4 autocorrelations are jointly insignificant
. predict double resid, residual
{txt}(2 missing values generated)

{com}. wntestq resid, lags(4)

{txt}Portmanteau test for white noise
{hline 39}
 Portmanteau (Q) statistic = {res}    1.1540
{txt} Prob > chi2({res}4{txt})            = {res}    0.8856
{txt}
{com}. drop resid
{txt}
{com}. 
. *Negative binomial
. count if iUS_Target==0
{res}   34
{txt}
{com}. *34 zero observations - grid search to find c ==> c=0.22
. gen ystar=iUS_Target
{txt}
{com}. replace ystar=0.22 if iUS_Target==0
{txt}(34 real changes made)

{com}. gen liUS_Target=ln(ystar)
{txt}
{com}. nbreg iUS_Target L(1/2).liUS_Target FUND POST SEPT Dp IRAQ, robust

{txt}Fitting Poisson model:

Iteration 0:{col 16}log pseudolikelihood = {res}-394.83575{txt}  
Iteration 1:{col 16}log pseudolikelihood = {res}-394.34181{txt}  
Iteration 2:{col 16}log pseudolikelihood = {res}-394.24465{txt}  
Iteration 3:{col 16}log pseudolikelihood = {res} -394.2354{txt}  
Iteration 4:{col 16}log pseudolikelihood = {res}-394.23372{txt}  
Iteration 5:{col 16}log pseudolikelihood = {res}-394.23345{txt}  
Iteration 6:{col 16}log pseudolikelihood = {res}-394.23338{txt}  
Iteration 7:{col 16}log pseudolikelihood = {res}-394.23337{txt}  

Fitting constant-only model:

Iteration 0:{col 16}log pseudolikelihood = {res}-352.78507{txt}  
Iteration 1:{col 16}log pseudolikelihood = {res}-352.52752{txt}  
Iteration 2:{col 16}log pseudolikelihood = {res}-352.52746{txt}  
Iteration 3:{col 16}log pseudolikelihood = {res}-352.52746{txt}  

Fitting full model:

Iteration 0:{col 16}log pseudolikelihood = {res}-338.87531{txt}  
Iteration 1:{col 16}log pseudolikelihood = {res} -334.9564{txt}  
Iteration 2:{col 16}log pseudolikelihood = {res} -334.2693{txt}  
Iteration 3:{col 16}log pseudolikelihood = {res}-334.26559{txt}  
Iteration 4:{col 16}log pseudolikelihood = {res}-334.26559{txt}  

Negative binomial regression                      Number of obs   =  {res}      158
{txt}Dispersion           = {res}mean                       {txt}Wald chi2({res}7{txt})    =  {res}   359.04
{txt}Log pseudolikelihood = {res}-334.26559                 {txt}Prob > chi2     =  {res}   0.0000

{col 1}{text}{hline 13}{c TT}{hline 11}{hline 11}{hline 9}{hline 9}{hline 12}{hline 12}
{col 14}{text}{c |}{col 26}    Robust
{col 1}{text}  iUS_Target{col 14}{c |}      Coef.{col 26}   Std. Err.{col 37}      z{col 46}   P>|z|{col 55}    [95% Conf. Interval]
{col 1}{text}{hline 13}{c +}{hline 11}{hline 11}{hline 9}{hline 9}{hline 12}{hline 12}
{col 1}{text} liUS_Target{col 14}{c |}
{col 1}{text}         L1.{col 14}{c |}{result}{space 2} .0602664{col 26}{space 2} .0742322{col 37}{space 1}    0.81{col 46}{space 3}0.417{col 55}{space 3}-.0852261{col 67}{space 3} .2057589
{col 1}{text}         L2.{col 14}{c |}{result}{space 2} .0181968{col 26}{space 2} .0669131{col 37}{space 1}    0.27{col 46}{space 3}0.786{col 55}{space 3}-.1129505{col 67}{space 3}  .149344
{col 1}{text}        FUND{col 14}{c |}{result}{space 2} .1276848{col 26}{space 2} .2699872{col 37}{space 1}    0.47{col 46}{space 3}0.636{col 55}{space 3}-.4014804{col 67}{space 3} .6568501
{col 1}{text}        POST{col 14}{c |}{result}{space 2} .7612892{col 26}{space 2} .2640445{col 37}{space 1}    2.88{col 46}{space 3}0.004{col 55}{space 3} .2437714{col 67}{space 3} 1.278807
{col 1}{text}        SEPT{col 14}{c |}{result}{space 2} .4621779{col 26}{space 2} .3251887{col 37}{space 1}    1.42{col 46}{space 3}0.155{col 55}{space 3}-.1751803{col 67}{space 3} 1.099536
{col 1}{text}          Dp{col 14}{c |}{result}{space 2}-19.03742{col 26}{space 2} 1.045702{col 37}{space 1}  -18.21{col 46}{space 3}0.000{col 55}{space 3}-21.08696{col 67}{space 3}-16.98788
{col 1}{text}        IRAQ{col 14}{c |}{result}{space 2}-1.038396{col 26}{space 2} .3352225{col 37}{space 1}   -3.10{col 46}{space 3}0.002{col 55}{space 3} -1.69542{col 67}{space 3}-.3813721
{col 1}{text}       _cons{col 14}{c |}{result}{space 2} .5864772{col 26}{space 2} .1869206{col 37}{space 1}    3.14{col 46}{space 3}0.002{col 55}{space 3} .2201196{col 67}{space 3} .9528347
{col 1}{text}{hline 13}{c +}{hline 11}{hline 11}{hline 9}{hline 9}{hline 12}{hline 12}
{col 1}{text}    /lnalpha{col 14}{c |}{result}{space 2} -.502288{col 27}{space 1} .2123604{col 55}{space 3}-.9185067{col 67}{space 3}-.0860692
{col 1}{text}{hline 13}{c +}{hline 12}{hline 12}{hline 8}{hline 8}{hline 12}{hline 12}
{col 1}{text}       alpha{col 14}{c |}{result}{space 2} .6051445{col 27}{space 1} .1285087{col 55}{space 3} .3991146{col 67}{space 3} .9175307
{col 1}{text}{hline 13}{c BT}{hline 11}{hline 11}{hline 9}{hline 9}{hline 12}{hline 12}

{com}. test

{txt} ( 1)  {res}[iUS_Target]L.liUS_Target = 0
{txt} ( 2)  {res}[iUS_Target]L2.liUS_Target = 0
{txt} ( 3)  {res}[iUS_Target]FUND = 0
{txt} ( 4)  {res}[iUS_Target]POST = 0
{txt} ( 5)  {res}[iUS_Target]SEPT = 0
{txt} ( 6)  {res}[iUS_Target]Dp = 0
{txt} ( 7)  {res}[iUS_Target]IRAQ = 0

           {txt}chi2(  7) ={res}  359.04
         {txt}Prob > chi2 ={res}    0.0000

{txt}
{com}. predict double iUS_Target_pred
{txt}(option n assumed; predicted number of events)
(2 missing values generated)

{com}. line iUS_Target iUS_Target_pred Quarter
{res}{txt}
{com}. 
. *Testing null that 9/11 did have no impact on terrorism patterns (for F column)
. test SEPT Dp

{txt} ( 1)  {res}[iUS_Target]SEPT = 0
{txt} ( 2)  {res}[iUS_Target]Dp = 0

{txt}{col 12}chi2(  2) ={res}  342.19
{txt}{col 10}Prob > chi2 =  {res}  0.0000
{txt}
{com}. * Ljung-Box statistic Q(4) - testing H0: white noise(in residuals)--> the first 4 autocorrelations are jointly insignificant
. *** Predicting Pearson residuals
. scalar s2 = exp(_b[/lnalpha]) 
{txt}
{com}. gen nbresidual = (iUS_Target-iUS_Target_pred)/sqrt( iUS_Target_pred*(1+iUS_Target_pred*s2) )
{txt}(2 missing values generated)

{com}. wntestq nbresidual, lags(4)

{txt}Portmanteau test for white noise
{hline 39}
 Portmanteau (Q) statistic = {res}    3.9173
{txt} Prob > chi2({res}4{txt})            = {res}    0.4173
{txt}
{com}. drop nbresidual iUS_Target_pred
{txt}
{com}. 
. * Which one is better fit? Based on AIC and BIC
. qui nbreg iUS_Target L(1/2).liUS_Target FUND POST SEPT Dp IRAQ, robust
{txt}
{com}. estat ic

{txt}{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  158{col 25}-352.5275{col 37}-334.2656{col 48}    9{col 57} 686.5312{col 69} 714.0945
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{com}. qui regress iUS_Target L(1/2).iUS_Target FUND POST SEPT Dp IRAQ, robust
{txt}
{com}. estat ic

{txt}{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  158{col 25}-426.2244{col 37}-405.6509{col 48}    7{col 57} 825.3018{col 69}   846.74
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{com}. qui nbreg iUS_Target L(1/2).iUS_Target FUND POST SEPT Dp IRAQ, robust
{txt}
{com}. estat ic

{txt}{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  158{col 25}-352.5275{col 37}-333.0628{col 48}    9{col 57} 684.1256{col 69}  711.689
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{com}. qui poisson iUS_Target L(1/2).iUS_Target FUND POST SEPT Dp IRAQ, robust
{txt}
{com}. estat ic

{txt}{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  158{col 25}-456.0602{col 37}-387.5736{col 48}    8{col 57} 791.1471{col 69} 815.6479
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{com}. drop ystar liUS_Target
{txt}
{com}. 
. *** Casualty incidents with a U.S. Target                                                                                               
. 
. *MIPT
. sum mUSCasualty

{txt}    Variable {c |}       Obs        Mean    Std. Dev.       Min        Max
{hline 13}{c +}{hline 56}
 mUSCasualty {c |}{res}       160          .7    1.026688          0          5
{txt}
{com}. tab Quarter if mUSCasualty==0

    {txt}Quarter {c |}      Freq.     Percent        Cum.
{hline 12}{c +}{hline 35}
     1968:1 {c |}{res}          1        1.08        1.08
{txt}     1968:2 {c |}{res}          1        1.08        2.15
{txt}     1968:3 {c |}{res}          1        1.08        3.23
{txt}     1968:4 {c |}{res}          1        1.08        4.30
{txt}     1969:1 {c |}{res}          1        1.08        5.38
{txt}     1969:2 {c |}{res}          1        1.08        6.45
{txt}     1969:4 {c |}{res}          1        1.08        7.53
{txt}     1970:3 {c |}{res}          1        1.08        8.60
{txt}     1970:4 {c |}{res}          1        1.08        9.68
{txt}     1971:4 {c |}{res}          1        1.08       10.75
{txt}     1972:1 {c |}{res}          1        1.08       11.83
{txt}     1972:2 {c |}{res}          1        1.08       12.90
{txt}     1972:3 {c |}{res}          1        1.08       13.98
{txt}     1972:4 {c |}{res}          1        1.08       15.05
{txt}     1973:1 {c |}{res}          1        1.08       16.13
{txt}     1973:2 {c |}{res}          1        1.08       17.20
{txt}     1973:3 {c |}{res}          1        1.08       18.28
{txt}     1973:4 {c |}{res}          1        1.08       19.35
{txt}     1974:1 {c |}{res}          1        1.08       20.43
{txt}     1974:3 {c |}{res}          1        1.08       21.51
{txt}     1975:2 {c |}{res}          1        1.08       22.58
{txt}     1975:4 {c |}{res}          1        1.08       23.66
{txt}     1976:1 {c |}{res}          1        1.08       24.73
{txt}     1976:2 {c |}{res}          1        1.08       25.81
{txt}     1976:3 {c |}{res}          1        1.08       26.88
{txt}     1976:4 {c |}{res}          1        1.08       27.96
{txt}     1977:3 {c |}{res}          1        1.08       29.03
{txt}     1978:1 {c |}{res}          1        1.08       30.11
{txt}     1978:3 {c |}{res}          1        1.08       31.18
{txt}     1978:4 {c |}{res}          1        1.08       32.26
{txt}     1979:2 {c |}{res}          1        1.08       33.33
{txt}     1979:4 {c |}{res}          1        1.08       34.41
{txt}     1980:1 {c |}{res}          1        1.08       35.48
{txt}     1980:2 {c |}{res}          1        1.08       36.56
{txt}     1980:3 {c |}{res}          1        1.08       37.63
{txt}     1980:4 {c |}{res}          1        1.08       38.71
{txt}     1981:1 {c |}{res}          1        1.08       39.78
{txt}     1981:2 {c |}{res}          1        1.08       40.86
{txt}     1981:3 {c |}{res}          1        1.08       41.94
{txt}     1981:4 {c |}{res}          1        1.08       43.01
{txt}     1982:1 {c |}{res}          1        1.08       44.09
{txt}     1982:2 {c |}{res}          1        1.08       45.16
{txt}     1982:3 {c |}{res}          1        1.08       46.24
{txt}     1982:4 {c |}{res}          1        1.08       47.31
{txt}     1983:1 {c |}{res}          1        1.08       48.39
{txt}     1983:2 {c |}{res}          1        1.08       49.46
{txt}     1983:3 {c |}{res}          1        1.08       50.54
{txt}     1983:4 {c |}{res}          1        1.08       51.61
{txt}     1984:3 {c |}{res}          1        1.08       52.69
{txt}     1984:4 {c |}{res}          1        1.08       53.76
{txt}     1985:1 {c |}{res}          1        1.08       54.84
{txt}     1985:2 {c |}{res}          1        1.08       55.91
{txt}     1985:3 {c |}{res}          1        1.08       56.99
{txt}     1985:4 {c |}{res}          1        1.08       58.06
{txt}     1986:4 {c |}{res}          1        1.08       59.14
{txt}     1987:1 {c |}{res}          1        1.08       60.22
{txt}     1987:2 {c |}{res}          1        1.08       61.29
{txt}     1987:3 {c |}{res}          1        1.08       62.37
{txt}     1987:4 {c |}{res}          1        1.08       63.44
{txt}     1988:1 {c |}{res}          1        1.08       64.52
{txt}     1988:4 {c |}{res}          1        1.08       65.59
{txt}     1989:1 {c |}{res}          1        1.08       66.67
{txt}     1989:2 {c |}{res}          1        1.08       67.74
{txt}     1989:4 {c |}{res}          1        1.08       68.82
{txt}     1990:2 {c |}{res}          1        1.08       69.89
{txt}     1990:3 {c |}{res}          1        1.08       70.97
{txt}     1990:4 {c |}{res}          1        1.08       72.04
{txt}     1991:1 {c |}{res}          1        1.08       73.12
{txt}     1991:4 {c |}{res}          1        1.08       74.19
{txt}     1992:2 {c |}{res}          1        1.08       75.27
{txt}     1992:3 {c |}{res}          1        1.08       76.34
{txt}     1994:2 {c |}{res}          1        1.08       77.42
{txt}     1994:4 {c |}{res}          1        1.08       78.49
{txt}     1995:3 {c |}{res}          1        1.08       79.57
{txt}     1995:4 {c |}{res}          1        1.08       80.65
{txt}     1996:2 {c |}{res}          1        1.08       81.72
{txt}     1996:4 {c |}{res}          1        1.08       82.80
{txt}     1997:2 {c |}{res}          1        1.08       83.87
{txt}     1997:3 {c |}{res}          1        1.08       84.95
{txt}     1998:1 {c |}{res}          1        1.08       86.02
{txt}     1998:2 {c |}{res}          1        1.08       87.10
{txt}     1999:2 {c |}{res}          1        1.08       88.17
{txt}     1999:4 {c |}{res}          1        1.08       89.25
{txt}     2000:1 {c |}{res}          1        1.08       90.32
{txt}     2000:2 {c |}{res}          1        1.08       91.40
{txt}     2000:3 {c |}{res}          1        1.08       92.47
{txt}     2003:4 {c |}{res}          1        1.08       93.55
{txt}     2004:1 {c |}{res}          1        1.08       94.62
{txt}     2005:1 {c |}{res}          1        1.08       95.70
{txt}     2005:2 {c |}{res}          1        1.08       96.77
{txt}     2007:2 {c |}{res}          1        1.08       97.85
{txt}     2007:3 {c |}{res}          1        1.08       98.92
{txt}     2007:4 {c |}{res}          1        1.08      100.00
{txt}{hline 12}{c +}{hline 35}
      Total {c |}{res}         93      100.00
{txt}
{com}. forvalues i=1/8 {c -(}
{txt}  2{com}. qui arima mUSCasualty, ar(1/`i')
{txt}  3{com}. estat ic
{txt}  4{com}. {c )-}

{txt}{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  160{col 25}        .{col 37}-225.5267{col 48}    3{col 57} 457.0533{col 69} 466.2789
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  160{col 25}        .{col 37}-224.0537{col 48}    4{col 57} 456.1075{col 69} 468.4082
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  160{col 25}        .{col 37}-223.7215{col 48}    5{col 57} 457.4429{col 69} 472.8188
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  160{col 25}        .{col 37}-223.4451{col 48}    6{col 57} 458.8901{col 69} 477.3412
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  160{col 25}        .{col 37}-223.3892{col 48}    7{col 57} 460.7784{col 69} 482.3047
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  160{col 25}        .{col 37}-222.8613{col 48}    8{col 57} 461.7225{col 69} 486.3239
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  160{col 25}        .{col 37}-222.7812{col 48}    9{col 57} 463.5624{col 69} 491.2389
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  160{col 25}        .{col 37}  -221.44{col 48}   10{col 57} 462.8799{col 69} 493.6317
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{com}. 
. * Choosing model AR(14) according to AIC and AR(1) according to BIC
. * Parsimonity --> estimating AR(1)
. 
. regress mUSCasualty L.mUSCasualty FUND POST SEPT Dp IRAQ, robust

{txt}Linear regression                                      Number of obs ={res}     159
                                                       {help j_robustsingular:F(  5,   152) =}       .
                                                       {txt}Prob > F      = {res}      .
                                                       {txt}R-squared     = {res} 0.1925
                                                       {txt}Root MSE      = {res}  .9422

{txt}{hline 13}{c TT}{hline 64}
             {c |}               Robust
 mUSCasualty {c |}      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
{hline 13}{char +}{hline 64}
 mUSCasualty {c |}
         L1. {c |}  {res} .0851438   .0959469     0.89   0.376     -.104418    .2747056
        {txt}FUND {c |}  {res}-.0441767   .1344805    -0.33   0.743    -.3098689    .2215155
        {txt}POST {c |}  {res} .6495857   .2420538     2.68   0.008     .1713615     1.12781
        {txt}SEPT {c |}  {res} .7337715   .4101581     1.79   0.076    -.0765754    1.544118
          {txt}Dp {c |}  {res} .2158375   .3537066     0.61   0.543    -.4829783    .9146534
        {txt}IRAQ {c |}  {res}-.5903215   .4696889    -1.26   0.211    -1.518283      .33764
       {txt}_cons {c |}  {res} .3598382   .0942969     3.82   0.000     .1735363    .5461401
{txt}{hline 13}{c BT}{hline 64}

{com}. 
. predict double mUSCasualty_pred
{txt}(option xb assumed; fitted values)
(1 missing value generated)

{com}. line mUSCasualty mUSCasualty_pred Quarter
{res}{txt}
{com}. drop mUSCasualty_pred
{txt}
{com}. 
. *Testing null that 9/11 did have no impact on terrorism patterns (for F column)
. test SEPT Dp

{txt} ( 1)  {res}SEPT = 0
{txt} ( 2)  {res}Dp = 0

{txt}       F(  2,   152) ={res}   10.58
{txt}{col 13}Prob > F ={res}    0.0000
{txt}
{com}. 
. * Ljung-Box statistic Q(4) - testing H0: white noise(in residuals)--> the first 4 autocorrelations are jointly insignificant
. predict double resid, residual
{txt}(1 missing value generated)

{com}. wntestq resid, lags(4)

{txt}Portmanteau test for white noise
{hline 39}
 Portmanteau (Q) statistic = {res}    0.7688
{txt} Prob > chi2({res}4{txt})            = {res}    0.9426
{txt}
{com}. drop resid
{txt}
{com}. 
. *Negative binomial
. count if mUSCasualty==0
{res}   93
{txt}
{com}. *93 zero observations - grid search to find c ==> c=0.01
. gen ystar=mUSCasualty
{txt}
{com}. replace ystar=0.01 if mUSCasualty==0
{txt}(93 real changes made)

{com}. gen lmUSCasualty=ln(ystar)
{txt}
{com}. nbreg mUSCasualty L.lmUSCasualty FUND POST SEPT Dp IRAQ, robust

{txt}Fitting Poisson model:

Iteration 0:{col 16}log pseudolikelihood = {res}-169.80001{txt}  
Iteration 1:{col 16}log pseudolikelihood = {res}-169.73789{txt}  
Iteration 2:{col 16}log pseudolikelihood = {res}-169.73776{txt}  
Iteration 3:{col 16}log pseudolikelihood = {res}-169.73776{txt}  

Fitting constant-only model:

Iteration 0:{col 16}log pseudolikelihood = {res}-183.74656{txt}  
Iteration 1:{col 16}log pseudolikelihood = {res}-183.58589{txt}  
Iteration 2:{col 16}log pseudolikelihood = {res}-183.58589{txt}  

Fitting full model:

Iteration 0:{col 16}log pseudolikelihood = {res}-171.64988{txt}  
Iteration 1:{col 16}log pseudolikelihood = {res}-168.79275{txt}  
Iteration 2:{col 16}log pseudolikelihood = {res}-168.49738{txt}  
Iteration 3:{col 16}log pseudolikelihood = {res}-168.49042{txt}  
Iteration 4:{col 16}log pseudolikelihood = {res} -168.4904{txt}  
Iteration 5:{col 16}log pseudolikelihood = {res} -168.4904{txt}  

Negative binomial regression                      Number of obs   =  {res}      159
{txt}Dispersion           = {res}mean                       {txt}Wald chi2({res}5{txt})    =  {res}        .
{txt}Log pseudolikelihood = {res}-168.4904                  {txt}Prob > chi2     =  {res}        .

{col 1}{text}{hline 13}{c TT}{hline 11}{hline 11}{hline 9}{hline 9}{hline 12}{hline 12}
{col 14}{text}{c |}{col 26}    Robust
{col 1}{text} mUSCasualty{col 14}{c |}      Coef.{col 26}   Std. Err.{col 37}      z{col 46}   P>|z|{col 55}    [95% Conf. Interval]
{col 1}{text}{hline 13}{c +}{hline 11}{hline 11}{hline 9}{hline 9}{hline 12}{hline 12}
{col 1}{text}lmUSCasualty{col 14}{c |}
{col 1}{text}         L1.{col 14}{c |}{result}{space 2} .0474175{col 26}{space 2} .0477853{col 37}{space 1}    0.99{col 46}{space 3}0.321{col 55}{space 3}  -.04624{col 67}{space 3}  .141075
{col 1}{text}        FUND{col 14}{c |}{result}{space 2} -.110042{col 26}{space 2} .3651353{col 37}{space 1}   -0.30{col 46}{space 3}0.763{col 55}{space 3}-.8256939{col 67}{space 3}   .60561
{col 1}{text}        POST{col 14}{c |}{result}{space 2} 1.045842{col 26}{space 2} .3642522{col 37}{space 1}    2.87{col 46}{space 3}0.004{col 55}{space 3} .3319207{col 67}{space 3} 1.759763
{col 1}{text}        SEPT{col 14}{c |}{result}{space 2}  .457519{col 26}{space 2} .2850597{col 37}{space 1}    1.60{col 46}{space 3}0.108{col 55}{space 3}-.1011878{col 67}{space 3} 1.016226
{col 1}{text}          Dp{col 14}{c |}{result}{space 2} .0960735{col 26}{space 2} .1779333{col 37}{space 1}    0.54{col 46}{space 3}0.589{col 55}{space 3}-.2526695{col 67}{space 3} .4448164
{col 1}{text}        IRAQ{col 14}{c |}{result}{space 2}-.3555337{col 26}{space 2}  .311047{col 37}{space 1}   -1.14{col 46}{space 3}0.253{col 55}{space 3}-.9651745{col 67}{space 3} .2541072
{col 1}{text}       _cons{col 14}{c |}{result}{space 2}-.7962452{col 26}{space 2} .2449702{col 37}{space 1}   -3.25{col 46}{space 3}0.001{col 55}{space 3}-1.276378{col 67}{space 3}-.3161123
{col 1}{text}{hline 13}{c +}{hline 11}{hline 11}{hline 9}{hline 9}{hline 12}{hline 12}
{col 1}{text}    /lnalpha{col 14}{c |}{result}{space 2}-1.315234{col 27}{space 1} .7153364{col 55}{space 3}-2.717267{col 67}{space 3} .0867999
{col 1}{text}{hline 13}{c +}{hline 12}{hline 12}{hline 8}{hline 8}{hline 12}{hline 12}
{col 1}{text}       alpha{col 14}{c |}{result}{space 2} .2684116{col 27}{space 1} .1920046{col 55}{space 3}  .066055{col 67}{space 3} 1.090678
{col 1}{text}{hline 13}{c BT}{hline 11}{hline 11}{hline 9}{hline 9}{hline 12}{hline 12}

{com}. test

{txt} ( 1)  {res}[mUSCasualty]L.lmUSCasualty = 0
{txt} ( 2)  {res}[mUSCasualty]FUND = 0
{txt} ( 3)  {res}[mUSCasualty]POST = 0
{txt} ( 4)  {res}[mUSCasualty]SEPT = 0
{txt} ( 5)  {res}[mUSCasualty]Dp = 0
{txt} ( 6)  {res}[mUSCasualty]IRAQ = 0

           {txt}chi2(  6) ={res}  107.73
         {txt}Prob > chi2 ={res}    0.0000

{txt}
{com}. predict double mUSCasualty_pred
{txt}(option n assumed; predicted number of events)
(1 missing value generated)

{com}. line mUSCasualty mUSCasualty_pred Quarter
{res}{txt}
{com}. 
. *Testing null that 9/11 did have no impact on terrorism patterns (for F column)
. test SEPT Dp

{txt} ( 1)  {res}[mUSCasualty]SEPT = 0
{txt} ( 2)  {res}[mUSCasualty]Dp = 0

{txt}{col 12}chi2(  2) ={res}    7.19
{txt}{col 10}Prob > chi2 =  {res}  0.0275
{txt}
{com}. * Ljung-Box statistic Q(4) - testing H0: white noise(in residuals)--> the first 4 autocorrelations are jointly insignificant
. *** Predicting Pearson residuals
. scalar s2 = exp(_b[/lnalpha]) 
{txt}
{com}. gen nbresidual = (mUSCasualty-mUSCasualty_pred)/sqrt( mUSCasualty_pred*(1+mUSCasualty_pred*s2) )
{txt}(1 missing value generated)

{com}. wntestq nbresidual, lags(4)

{txt}Portmanteau test for white noise
{hline 39}
 Portmanteau (Q) statistic = {res}    2.5447
{txt} Prob > chi2({res}4{txt})            = {res}    0.6366
{txt}
{com}. drop nbresidual mUSCasualty_pred
{txt}
{com}. 
. * Which one is better fit? Based on AIC and BIC
. qui nbreg mUSCasualty L.lmUSCasualty FUND POST SEPT Dp IRAQ, robust
{txt}
{com}. estat ic

{txt}{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  159{col 25}-183.5859{col 37}-168.4904{col 48}    7{col 57} 350.9808{col 69} 372.4631
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{com}. qui regress mUSCasualty L.mUSCasualty FUND POST SEPT Dp IRAQ, robust
{txt}
{com}. estat ic

{txt}{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  159{col 25}-229.5647{col 37} -212.565{col 48}    6{col 57} 437.1301{col 69} 455.5435
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{com}. qui nbreg mUSCasualty L.mUSCasualty FUND POST SEPT Dp IRAQ, robust
{txt}
{com}. estat ic

{txt}{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  159{col 25}-183.5859{col 37}-168.5423{col 48}    7{col 57} 351.0846{col 69} 372.5669
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{com}. qui poisson mUSCasualty L.mUSCasualty FUND POST SEPT Dp IRAQ, robust
{txt}
{com}. estat ic

{txt}{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  159{col 25} -190.586{col 37}-169.8069{col 48}    6{col 57} 351.6138{col 69} 370.0272
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{com}. drop ystar lmUSCasualty
{txt}
{com}. 
. *ITERATE
. sum iUSCasualty

{txt}    Variable {c |}       Obs        Mean    Std. Dev.       Min        Max
{hline 13}{c +}{hline 56}
 iUSCasualty {c |}{res}       160         1.1    1.701646          0         15
{txt}
{com}. tab Quarter if iUSCasualty==0

    {txt}Quarter {c |}      Freq.     Percent        Cum.
{hline 12}{c +}{hline 35}
     1968:1 {c |}{res}          1        1.37        1.37
{txt}     1968:2 {c |}{res}          1        1.37        2.74
{txt}     1968:3 {c |}{res}          1        1.37        4.11
{txt}     1968:4 {c |}{res}          1        1.37        5.48
{txt}     1969:1 {c |}{res}          1        1.37        6.85
{txt}     1969:2 {c |}{res}          1        1.37        8.22
{txt}     1969:4 {c |}{res}          1        1.37        9.59
{txt}     1970:3 {c |}{res}          1        1.37       10.96
{txt}     1970:4 {c |}{res}          1        1.37       12.33
{txt}     1971:4 {c |}{res}          1        1.37       13.70
{txt}     1972:1 {c |}{res}          1        1.37       15.07
{txt}     1972:2 {c |}{res}          1        1.37       16.44
{txt}     1973:1 {c |}{res}          1        1.37       17.81
{txt}     1973:2 {c |}{res}          1        1.37       19.18
{txt}     1973:3 {c |}{res}          1        1.37       20.55
{txt}     1973:4 {c |}{res}          1        1.37       21.92
{txt}     1974:1 {c |}{res}          1        1.37       23.29
{txt}     1974:3 {c |}{res}          1        1.37       24.66
{txt}     1975:1 {c |}{res}          1        1.37       26.03
{txt}     1975:2 {c |}{res}          1        1.37       27.40
{txt}     1975:4 {c |}{res}          1        1.37       28.77
{txt}     1976:1 {c |}{res}          1        1.37       30.14
{txt}     1976:2 {c |}{res}          1        1.37       31.51
{txt}     1976:3 {c |}{res}          1        1.37       32.88
{txt}     1976:4 {c |}{res}          1        1.37       34.25
{txt}     1977:3 {c |}{res}          1        1.37       35.62
{txt}     1978:1 {c |}{res}          1        1.37       36.99
{txt}     1978:2 {c |}{res}          1        1.37       38.36
{txt}     1978:3 {c |}{res}          1        1.37       39.73
{txt}     1978:4 {c |}{res}          1        1.37       41.10
{txt}     1979:2 {c |}{res}          1        1.37       42.47
{txt}     1979:3 {c |}{res}          1        1.37       43.84
{txt}     1980:1 {c |}{res}          1        1.37       45.21
{txt}     1980:2 {c |}{res}          1        1.37       46.58
{txt}     1980:3 {c |}{res}          1        1.37       47.95
{txt}     1980:4 {c |}{res}          1        1.37       49.32
{txt}     1981:2 {c |}{res}          1        1.37       50.68
{txt}     1981:3 {c |}{res}          1        1.37       52.05
{txt}     1981:4 {c |}{res}          1        1.37       53.42
{txt}     1982:3 {c |}{res}          1        1.37       54.79
{txt}     1982:4 {c |}{res}          1        1.37       56.16
{txt}     1983:4 {c |}{res}          1        1.37       57.53
{txt}     1984:2 {c |}{res}          1        1.37       58.90
{txt}     1985:1 {c |}{res}          1        1.37       60.27
{txt}     1985:2 {c |}{res}          1        1.37       61.64
{txt}     1985:4 {c |}{res}          1        1.37       63.01
{txt}     1986:1 {c |}{res}          1        1.37       64.38
{txt}     1986:4 {c |}{res}          1        1.37       65.75
{txt}     1987:1 {c |}{res}          1        1.37       67.12
{txt}     1987:3 {c |}{res}          1        1.37       68.49
{txt}     1987:4 {c |}{res}          1        1.37       69.86
{txt}     1988:3 {c |}{res}          1        1.37       71.23
{txt}     1988:4 {c |}{res}          1        1.37       72.60
{txt}     1989:2 {c |}{res}          1        1.37       73.97
{txt}     1989:3 {c |}{res}          1        1.37       75.34
{txt}     1990:2 {c |}{res}          1        1.37       76.71
{txt}     1990:3 {c |}{res}          1        1.37       78.08
{txt}     1991:1 {c |}{res}          1        1.37       79.45
{txt}     1991:3 {c |}{res}          1        1.37       80.82
{txt}     1992:1 {c |}{res}          1        1.37       82.19
{txt}     1992:2 {c |}{res}          1        1.37       83.56
{txt}     1992:3 {c |}{res}          1        1.37       84.93
{txt}     1994:2 {c |}{res}          1        1.37       86.30
{txt}     1994:4 {c |}{res}          1        1.37       87.67
{txt}     1995:4 {c |}{res}          1        1.37       89.04
{txt}     1997:2 {c |}{res}          1        1.37       90.41
{txt}     1998:1 {c |}{res}          1        1.37       91.78
{txt}     1998:2 {c |}{res}          1        1.37       93.15
{txt}     2000:1 {c |}{res}          1        1.37       94.52
{txt}     2001:2 {c |}{res}          1        1.37       95.89
{txt}     2001:3 {c |}{res}          1        1.37       97.26
{txt}     2001:4 {c |}{res}          1        1.37       98.63
{txt}     2003:3 {c |}{res}          1        1.37      100.00
{txt}{hline 12}{c +}{hline 35}
      Total {c |}{res}         73      100.00
{txt}
{com}. forvalues i=1/8 {c -(}
{txt}  2{com}. qui arima iUSCasualty, ar(1/`i')
{txt}  3{com}. estat ic
{txt}  4{com}. {c )-}

{txt}{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  160{col 25}        .{col 37}-308.0936{col 48}    3{col 57} 622.1873{col 69} 631.4128
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  160{col 25}        .{col 37}-303.7519{col 48}    4{col 57} 615.5039{col 69} 627.8046
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  160{col 25}        .{col 37}-301.0266{col 48}    5{col 57} 612.0533{col 69} 627.4292
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  160{col 25}        .{col 37}-300.9894{col 48}    6{col 57} 613.9788{col 69} 632.4299
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  160{col 25}        .{col 37}-299.7687{col 48}    7{col 57} 613.5374{col 69} 635.0636
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  160{col 25}        .{col 37}-299.7632{col 48}    8{col 57} 615.5263{col 69} 640.1277
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  160{col 25}        .{col 37}-299.1591{col 48}    9{col 57} 616.3183{col 69} 643.9949
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  160{col 25}        .{col 37}-298.5669{col 48}   10{col 57} 617.1339{col 69} 647.8856
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{com}. 
. * Choosing model AR(3) according to AIC and AR(3) according to BIC
. * Estimating AR(3)
. 
. regress iUSCasualty L(1/3).iUSCasualty FUND POST SEPT Dp IRAQ, robust

{txt}Linear regression                                      Number of obs ={res}     157
                                                       {help j_robustsingular:F(  7,   148) =}       .
                                                       {txt}Prob > F      = {res}      .
                                                       {txt}R-squared     = {res} 0.1987
                                                       {txt}Root MSE      = {res} 1.5725

{txt}{hline 13}{c TT}{hline 64}
             {c |}               Robust
 iUSCasualty {c |}      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
{hline 13}{char +}{hline 64}
 iUSCasualty {c |}
         L1. {c |}  {res} .0213935    .053119     0.40   0.688    -.0835761    .1263631
         {txt}L2. {c |}  {res} .1208093   .0663415     1.82   0.071    -.0102897    .2519082
         {txt}L3. {c |}  {res} .1305987   .2141126     0.61   0.543     -.292514    .5537115
        {txt}FUND {c |}  {res} .0973779   .2032336     0.48   0.633    -.3042366    .4989924
        {txt}POST {c |}  {res} .9733615   .3994682     2.44   0.016     .1839634     1.76276
        {txt}SEPT {c |}  {res} .8379365   .7581422     1.11   0.271    -.6602454    2.336118
          {txt}Dp {c |}  {res}-2.543179   .7245944    -3.51   0.001    -3.975066   -1.111291
        {txt}IRAQ {c |}  {res}-1.321385   .7339888    -1.80   0.074    -2.771836    .1290672
       {txt}_cons {c |}  {res} .3830947   .1877954     2.04   0.043      .011988    .7542013
{txt}{hline 13}{c BT}{hline 64}

{com}. 
. predict double iUSCasualty_pred
{txt}(option xb assumed; fitted values)
(3 missing values generated)

{com}. line iUSCasualty iUSCasualty_pred Quarter
{res}{txt}
{com}. drop iUSCasualty_pred
{txt}
{com}. 
. *Testing null that 9/11 did have no impact on terrorism patterns (for F column)
. test SEPT Dp

{txt} ( 1)  {res}SEPT = 0
{txt} ( 2)  {res}Dp = 0

{txt}       F(  2,   148) ={res}   13.98
{txt}{col 13}Prob > F ={res}    0.0000
{txt}
{com}. 
. * Ljung-Box statistic Q(4) - testing H0: white noise(in residuals)--> the first 4 autocorrelations are jointly insignificant
. predict double resid, residual
{txt}(3 missing values generated)

{com}. wntestq resid, lags(4)

{txt}Portmanteau test for white noise
{hline 39}
 Portmanteau (Q) statistic = {res}    0.2539
{txt} Prob > chi2({res}4{txt})            = {res}    0.9926
{txt}
{com}. drop resid
{txt}
{com}. 
. *Negative binomial
. count if iUSCasualty==0
{res}   73
{txt}
{com}. *73 zero observations - grid search to find c ==> c=0.2
. gen ystar=iUSCasualty
{txt}
{com}. replace ystar=0.2 if iUSCasualty==0
{txt}(73 real changes made)

{com}. gen liUSCasualty=ln(ystar)
{txt}
{com}. nbreg iUSCasualty L(1/3).liUSCasualty FUND POST SEPT Dp IRAQ, robust

{txt}Fitting Poisson model:

Iteration 0:{col 16}log pseudolikelihood = {res}-221.61294{txt}  
Iteration 1:{col 16}log pseudolikelihood = {res}-221.49692{txt}  
Iteration 2:{col 16}log pseudolikelihood = {res}-221.47046{txt}  
Iteration 3:{col 16}log pseudolikelihood = {res}-221.46458{txt}  
Iteration 4:{col 16}log pseudolikelihood = {res}-221.46338{txt}  
Iteration 5:{col 16}log pseudolikelihood = {res}-221.46311{txt}  
Iteration 6:{col 16}log pseudolikelihood = {res}-221.46305{txt}  
Iteration 7:{col 16}log pseudolikelihood = {res}-221.46303{txt}  

Fitting constant-only model:

Iteration 0:{col 16}log pseudolikelihood = {res}-230.27567{txt}  
Iteration 1:{col 16}log pseudolikelihood = {res}-230.21589{txt}  
Iteration 2:{col 16}log pseudolikelihood = {res}-230.21582{txt}  
Iteration 3:{col 16}log pseudolikelihood = {res}-230.21582{txt}  

Fitting full model:

Iteration 0:{col 16}log pseudolikelihood = {res}-216.22228{txt}  
Iteration 1:{col 16}log pseudolikelihood = {res} -211.6731{txt}  
Iteration 2:{col 16}log pseudolikelihood = {res}-210.52902{txt}  
Iteration 3:{col 16}log pseudolikelihood = {res}-210.51829{txt}  
Iteration 4:{col 16}log pseudolikelihood = {res}-210.51828{txt}  

Negative binomial regression                      Number of obs   =  {res}      157
{txt}Dispersion           = {res}mean                       {txt}Wald chi2({res}8{txt})    =  {res}   318.13
{txt}Log pseudolikelihood = {res}-210.51828                 {txt}Prob > chi2     =  {res}   0.0000

{col 1}{text}{hline 13}{c TT}{hline 11}{hline 11}{hline 9}{hline 9}{hline 12}{hline 12}
{col 14}{text}{c |}{col 26}    Robust
{col 1}{text} iUSCasualty{col 14}{c |}      Coef.{col 26}   Std. Err.{col 37}      z{col 46}   P>|z|{col 55}    [95% Conf. Interval]
{col 1}{text}{hline 13}{c +}{hline 11}{hline 11}{hline 9}{hline 9}{hline 12}{hline 12}
{col 1}{text}liUSCasualty{col 14}{c |}
{col 1}{text}         L1.{col 14}{c |}{result}{space 2}-.0060446{col 26}{space 2}  .093032{col 37}{space 1}   -0.06{col 46}{space 3}0.948{col 55}{space 3}-.1883839{col 67}{space 3} .1762948
{col 1}{text}         L2.{col 14}{c |}{result}{space 2} -.048458{col 26}{space 2}   .08668{col 37}{space 1}   -0.56{col 46}{space 3}0.576{col 55}{space 3}-.2183476{col 67}{space 3} .1214317
{col 1}{text}         L3.{col 14}{c |}{result}{space 2} .1335878{col 26}{space 2} .1112941{col 37}{space 1}    1.20{col 46}{space 3}0.230{col 55}{space 3}-.0845446{col 67}{space 3} .3517202
{col 1}{text}        FUND{col 14}{c |}{result}{space 2}  .198109{col 26}{space 2} .3185424{col 37}{space 1}    0.62{col 46}{space 3}0.534{col 55}{space 3}-.4262227{col 67}{space 3} .8224406
{col 1}{text}        POST{col 14}{c |}{result}{space 2} 1.065966{col 26}{space 2} .3194068{col 37}{space 1}    3.34{col 46}{space 3}0.001{col 55}{space 3} .4399398{col 67}{space 3} 1.691992
{col 1}{text}        SEPT{col 14}{c |}{result}{space 2} .3441095{col 26}{space 2} .3064078{col 37}{space 1}    1.12{col 46}{space 3}0.261{col 55}{space 3}-.2564388{col 67}{space 3} .9446578
{col 1}{text}          Dp{col 14}{c |}{result}{space 2}-17.51523{col 26}{space 2} 1.049589{col 37}{space 1}  -16.69{col 46}{space 3}0.000{col 55}{space 3}-19.57239{col 67}{space 3}-15.45807
{col 1}{text}        IRAQ{col 14}{c |}{result}{space 2}-.6963928{col 26}{space 2} .2701184{col 37}{space 1}   -2.58{col 46}{space 3}0.010{col 55}{space 3}-1.225815{col 67}{space 3}-.1669705
{col 1}{text}       _cons{col 14}{c |}{result}{space 2}-.5794717{col 26}{space 2} .3063555{col 37}{space 1}   -1.89{col 46}{space 3}0.059{col 55}{space 3}-1.179917{col 67}{space 3} .0209741
{col 1}{text}{hline 13}{c +}{hline 11}{hline 11}{hline 9}{hline 9}{hline 12}{hline 12}
{col 1}{text}    /lnalpha{col 14}{c |}{result}{space 2}-.7910372{col 27}{space 1}  .440805{col 55}{space 3}-1.654999{col 67}{space 3} .0729247
{col 1}{text}{hline 13}{c +}{hline 12}{hline 12}{hline 8}{hline 8}{hline 12}{hline 12}
{col 1}{text}       alpha{col 14}{c |}{result}{space 2} .4533743{col 27}{space 1} .1998497{col 55}{space 3} .1910922{col 67}{space 3}  1.07565
{col 1}{text}{hline 13}{c BT}{hline 11}{hline 11}{hline 9}{hline 9}{hline 12}{hline 12}

{com}. test

{txt} ( 1)  {res}[iUSCasualty]L.liUSCasualty = 0
{txt} ( 2)  {res}[iUSCasualty]L2.liUSCasualty = 0
{txt} ( 3)  {res}[iUSCasualty]L3.liUSCasualty = 0
{txt} ( 4)  {res}[iUSCasualty]FUND = 0
{txt} ( 5)  {res}[iUSCasualty]POST = 0
{txt} ( 6)  {res}[iUSCasualty]SEPT = 0
{txt} ( 7)  {res}[iUSCasualty]Dp = 0
{txt} ( 8)  {res}[iUSCasualty]IRAQ = 0

           {txt}chi2(  8) ={res}  318.13
         {txt}Prob > chi2 ={res}    0.0000

{txt}
{com}. predict double iUSCasualty_pred
{txt}(option n assumed; predicted number of events)
(3 missing values generated)

{com}. line iUSCasualty iUSCasualty_pred Quarter
{res}{txt}
{com}. 
. *Testing null that 9/11 did have no impact on terrorism patterns (for F column)
. test SEPT Dp

{txt} ( 1)  {res}[iUSCasualty]SEPT = 0
{txt} ( 2)  {res}[iUSCasualty]Dp = 0

{txt}{col 12}chi2(  2) ={res}  283.52
{txt}{col 10}Prob > chi2 =  {res}  0.0000
{txt}
{com}. * Ljung-Box statistic Q(4) - testing H0: white noise(in residuals)--> the first 4 autocorrelations are jointly insignificant
. *** Predicting Pearson residuals
. scalar s2 = exp(_b[/lnalpha]) 
{txt}
{com}. gen nbresidual = (iUSCasualty-iUSCasualty_pred)/sqrt( iUSCasualty_pred*(1+iUSCasualty_pred*s2) )
{txt}(3 missing values generated)

{com}. wntestq nbresidual, lags(4)

{txt}Portmanteau test for white noise
{hline 39}
 Portmanteau (Q) statistic = {res}    0.2866
{txt} Prob > chi2({res}4{txt})            = {res}    0.9907
{txt}
{com}. drop nbresidual iUSCasualty_pred
{txt}
{com}. 
. * Which one is better fit? Based on AIC and BIC
. qui nbreg iUSCasualty L(1/3).liUSCasualty FUND POST SEPT Dp IRAQ, robust
{txt}
{com}. estat ic

{txt}{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  157{col 25}-230.2158{col 37}-210.5183{col 48}   10{col 57} 441.0366{col 69}  471.599
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{com}. qui regress iUSCasualty L(1/3).iUSCasualty FUND POST SEPT Dp IRAQ, robust
{txt}
{com}. estat ic

{txt}{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  157{col 25}-306.5943{col 37}-289.2053{col 48}    8{col 57} 594.4107{col 69} 618.8606
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{com}. qui nbreg iUSCasualty L(1/3).iUSCasualty FUND POST SEPT Dp IRAQ, robust
{txt}
{com}. estat ic

{txt}{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  157{col 25}-230.2158{col 37}-210.0789{col 48}   10{col 57} 440.1578{col 69} 470.7202
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{com}. qui poisson iUSCasualty L(1/3).iUSCasualty FUND POST SEPT Dp IRAQ, robust
{txt}
{com}. estat ic

{txt}{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  157{col 25}-255.9737{col 37} -220.068{col 48}    9{col 57}  458.136{col 69} 485.6422
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{com}. drop ystar liUSCasualty
{txt}
{com}. 
{txt}end of do-file

{com}. log close
       {txt}log:  {res}LICs.smcl
  {txt}log type:  {res}smcl
 {txt}closed on:  {res} 9 Jan 2011, 16:39:04
{txt}{.-}
{smcl}
{txt}{sf}{ul off}